Last active
February 5, 2016 11:00
-
-
Save bitbonk/4b8d8ae69c57db5f5fc1 to your computer and use it in GitHub Desktop.
slow assertion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The Property Culture is of type CultureInfo | |
enumarableOfComplexObject.ShouldAllBeEquivalentTo( | |
new[] | |
{ | |
new { RefText = "Ref1", Culture = Invariant, Text = "Ref1 en", Component = string.Empty }, | |
new { RefText = "Ref3", Culture = Invariant, Text = "Ref3 en", Component = string.Empty }, | |
new { RefText = "Ref1", Culture = German, Text = "Ref1 de", Component = string.Empty }, | |
new { RefText = "Ref3", Culture = German, Text = "Ref3 de", Component = string.Empty }, | |
new { RefText = "Ref1", Culture = English, Text = "Ref1 en", Component = string.Empty }, | |
new { RefText = "Ref3", Culture = English, Text = "Ref3 en", Component = string.Empty }, | |
new { RefText = "Ref1", Culture = GermanGermany, Text = "Ref1 de", Component = string.Empty }, | |
new { RefText = "Ref3", Culture = GermanGermany, Text = "Ref3 de", Component = string.Empty }, | |
new { RefText = "Ref1", Culture = EnglishUs, Text = "Ref1 en", Component = string.Empty }, | |
new { RefText = "Ref3", Culture = EnglishUs, Text = "Ref3 en", Component = string.Empty }, | |
new { RefText = "Ref1", Culture = Invariant, Text = "Ref1 en", Component = "Comp1" }, | |
new { RefText = "Ref3", Culture = Invariant, Text = "Ref3 en", Component = "Comp1" }, | |
new { RefText = "Ref1", Culture = EnglishUs, Text = "Ref1 en", Component = "Comp1" }, | |
new { RefText = "Ref3", Culture = EnglishUs, Text = "Ref3 en", Component = "Comp1" } | |
}, | |
o => o.ExcludingMissingMembers().ComparingByValue<CultureInfo>()); |
I would have to analyze it myself. The comparison is trying to some smart things when comparing collections though.
Interesting:
o => o.ExcludingMissingMembers().ExcludingNestedObjects()
makes it fast and it asserts correctly (but I would have preferred .ComparingByValue<CultureInfo>());
Even more interesting (this looks like a bug to me):
o => o.Including(t => t.Culture));
will never fail, even if the cutltures differ!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is what the performance profiler says. Its a deep recursion. Could it be the CultureInfo instances? Is it not comparing them by value as it should? CultureInfo has a deeply nested structure, I think.