Skip to content

Commit

Permalink
Removed an obsolete overload of the AssertionScope constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisdoomen committed Mar 16, 2024
1 parent e969354 commit 78eed7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
10 changes: 0 additions & 10 deletions Src/FluentAssertions/Execution/AssertionScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,6 @@ public AssertionScope(IAssertionStrategy assertionStrategy)
SetCurrentAssertionScope(this);
}

/// <summary>
/// Starts a named scope within which multiple assertions can be executed
/// and which will not throw until the scope is disposed.
/// </summary>
public AssertionScope(Lazy<string> context)
: this()
{
Context = context;
}

/// <summary>
/// Starts a new scope based on the given assertion strategy and parent assertion scope
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,19 @@ public void Message_should_use_the_name_of_the_scope_as_context(string context)
}

[Fact]
public void Message_should_use_the_lazy_name_of_the_scope_as_context()
public void Nested_scopes_will_use_the_name_of_their_outer_scope_as_context()
{
// Act
Action act = () =>
{
using var _ = new AssertionScope(new Lazy<string>(() => "lazy foo"));
using var outerScope = new AssertionScope("outer");
using var innerScope = new AssertionScope("inner");
new[] { 1, 2, 3 }.Should().Equal(3, 2, 1);
};

// Assert
act.Should().Throw<XunitException>()
.WithMessage("Expected lazy foo to be equal to*");
.WithMessage("Expected outer/inner to be equal to*");
}

[Fact]
Expand Down

0 comments on commit 78eed7b

Please sign in to comment.