Skip to content

Commit

Permalink
Open Issues of fluentassertions#1829 are solved and the bug is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
94sedighi committed Nov 28, 2022
1 parent cdae4fa commit 03fb50a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
11 changes: 1 addition & 10 deletions Src/FluentAssertions/Execution/AssertionScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,16 +395,7 @@ public void Dispose()
parent.assertionStrategy.HandleFailure(failureMessage);
}

IDictionary<string, object> reportables = contextData.GetReportable();

if (reportables.Count > 0)
{
foreach (KeyValuePair<string, object> reportable in reportables)
{
parent.AddReportable(reportable.Key, reportable.Value.ToString());
}
}

parent.contextData.Add(contextData);
parent.AppendTracing(tracing.ToString());

parent = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,18 @@ public void When_asserting_collections_not_to_be_equivalent_with_options_but_sub
{
// Arrange
int[] actual = null;
int[] expectation = new[] { 1, 2, 3 };

// Act
Action act = () =>
{
using var _ = new AssertionScope();
actual.Should().NotBeEquivalentTo(new[] { 1, 2, 3 }, opt => opt, "we want to test the failure {0}", "message");
actual.Should().NotBeEquivalentTo(expectation, opt => opt, "we want to test the failure {0}", "message");
};

// Assert
act.Should().Throw<XunitException>()
.WithMessage("Expected actual not to be equivalent *failure message*, but found <null>.");
.WithMessage("Expected actual not to be equivalent *failure message*, but found <null>.*");
}

[Fact]
Expand Down

0 comments on commit 03fb50a

Please sign in to comment.