From 03fb50a3feb1cb2094fee03a47fb999dbc5b7ea8 Mon Sep 17 00:00:00 2001 From: bsedighi94 Date: Mon, 28 Nov 2022 10:10:21 +0100 Subject: [PATCH] Open Issues of #1829 are solved and the bug is fixed --- Src/FluentAssertions/Execution/AssertionScope.cs | 11 +---------- .../CollectionAssertionSpecs.BeEquivalentTo.cs | 5 +++-- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Src/FluentAssertions/Execution/AssertionScope.cs b/Src/FluentAssertions/Execution/AssertionScope.cs index a46d8cad95..5c84beb23e 100644 --- a/Src/FluentAssertions/Execution/AssertionScope.cs +++ b/Src/FluentAssertions/Execution/AssertionScope.cs @@ -395,16 +395,7 @@ public void Dispose() parent.assertionStrategy.HandleFailure(failureMessage); } - IDictionary reportables = contextData.GetReportable(); - - if (reportables.Count > 0) - { - foreach (KeyValuePair reportable in reportables) - { - parent.AddReportable(reportable.Key, reportable.Value.ToString()); - } - } - + parent.contextData.Add(contextData); parent.AppendTracing(tracing.ToString()); parent = null; diff --git a/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeEquivalentTo.cs b/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeEquivalentTo.cs index 166c2ef16c..2f4cb231a8 100644 --- a/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeEquivalentTo.cs +++ b/Tests/FluentAssertions.Specs/Collections/CollectionAssertionSpecs.BeEquivalentTo.cs @@ -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() - .WithMessage("Expected actual not to be equivalent *failure message*, but found ."); + .WithMessage("Expected actual not to be equivalent *failure message*, but found .*"); } [Fact]