Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When deeply nested collections where compared to an empty collection it threw #967

Merged
merged 1 commit into from Nov 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion Src/FluentAssertions/Execution/ChainedAssertionScope.cs
Expand Up @@ -62,7 +62,9 @@ public IAssertionScope BecauseOf(string because, params object[] becauseArgs)

public Continuation ClearExpectation()
{
return predecessor.ClearExpectation();
predecessor.ClearExpectation();

return new Continuation(predecessor, predecessorSucceeded);
}

public IAssertionScope WithExpectation(string message, params object[] args)
Expand Down
21 changes: 21 additions & 0 deletions Tests/Shared.Specs/CollectionEquivalencySpecs.cs
Expand Up @@ -582,6 +582,27 @@ public void
act.Should().NotThrow();
}

[Fact]
public void When_two_deeply_nested_collections_are_equivalent_while_ignoring_the_order_it_should_not_throw()
{
//-----------------------------------------------------------------------------------------------------------
// Arrange
//-----------------------------------------------------------------------------------------------------------
var items = new[]
{
new int[0],
new int[] { 42 }
};

//-----------------------------------------------------------------------------------------------------------
// Act / Assert
//-----------------------------------------------------------------------------------------------------------
items.Should().BeEquivalentTo(
new int[] { 42 },
new int[0]
);
}

[Fact]
public void
When_a_collection_property_contains_objects_with_mismatching_properties_it_should_throw
Expand Down