Created
July 24, 2013 19:14
-
-
Save dennisdoomen/6073558 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
[TestMethod] | |
public void When_a_nested_collection_is_unordered_but_order_is_strict_it_should_fail() | |
{ | |
//----------------------------------------------------------------------------------------------------------- | |
// Arrange | |
//----------------------------------------------------------------------------------------------------------- | |
var subject = new[] | |
{ | |
new | |
{ | |
Name = "John", | |
UnorderedCollection = new[] { 1, 2, 3, 4, 5} | |
}, | |
new | |
{ | |
Name = "Jane", | |
UnorderedCollection = new int[0] | |
} | |
}; | |
var expectation = new[] | |
{ | |
new | |
{ | |
Name = "John", | |
UnorderedCollection = new[] { 5, 4, 3, 2, 1} | |
}, | |
new | |
{ | |
Name = "Jane", | |
UnorderedCollection = new int[0] | |
}, | |
}; | |
//----------------------------------------------------------------------------------------------------------- | |
// Act | |
//----------------------------------------------------------------------------------------------------------- | |
Action action = () => subject.ShouldAllBeEquivalentTo(expectation, options => options | |
.WithStrictOrderingFor(s => s.UnorderedCollection)); | |
//----------------------------------------------------------------------------------------------------------- | |
// Assert | |
//----------------------------------------------------------------------------------------------------------- | |
action.ShouldThrow<AssertFailedException>(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment