Skip to content

Commit

Permalink
Merge pull request #2 from Ruijin92/develop
Browse files Browse the repository at this point in the history
Bug Fix: (1829) Added test for assertion scope - inner to outer scope
  • Loading branch information
94sedighi committed Nov 25, 2022
2 parents e9ff070 + 9ede529 commit cdae4fa
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Tests/FluentAssertions.Specs/Execution/AssertionScopeSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,24 @@ public void When_using_a_custom_strategy_it_should_include_failure_messages_of_a
.WithMessage("*but found false*but found true*");
}

[Fact]
public void When_nested_scope_is_disposed_it_passes_reports_to_parent_scope()
{
// Arrange/Act
using (var outerScope = new AssertionScope())
{
outerScope.AddReportable("outerReportable", "foo");

using (var innerScope = new AssertionScope())
{
innerScope.AddReportable("innerReportable", "bar");
}

// Assert
outerScope.Get<string>("innerReportable").Should().Be("bar");
}
}

public class CustomAssertionStrategy : IAssertionStrategy
{
private readonly List<string> failureMessages = new();
Expand Down

0 comments on commit cdae4fa

Please sign in to comment.