diff --git a/Tests/FluentAssertions.Specs/Specialized/TaskOfTAssertionSpecs.cs b/Tests/FluentAssertions.Specs/Specialized/TaskOfTAssertionSpecs.cs index 6ca939ceac..4d4c74e796 100644 --- a/Tests/FluentAssertions.Specs/Specialized/TaskOfTAssertionSpecs.cs +++ b/Tests/FluentAssertions.Specs/Specialized/TaskOfTAssertionSpecs.cs @@ -1,6 +1,7 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; +using FluentAssertions.Execution; using FluentAssertions.Extensions; #if NETFRAMEWORK using FluentAssertions.Specs.Common; @@ -31,6 +32,26 @@ await testAction.Should().ThrowAsync() .WithMessage("*because we want to test the failure message*found *"); } + [Fact] + public async Task When_subject_is_null_with_AssertionScope_it_should_fail() + { + // Arrange + var timeSpan = 0.Milliseconds(); + Func> action = null; + + // Act + Func testAction = () => + { + using var _ = new AssertionScope(); + return action.Should().CompleteWithinAsync( + timeSpan, "because we want to test the failure {0}", "message"); + }; + + // Assert + await testAction.Should().ThrowAsync() + .WithMessage("*because we want to test the failure message*found *"); + } + [Fact] public async Task When_task_completes_fast_it_should_succeed() {