diff --git a/Tests/FluentAssertions.Specs/Specialized/TaskOfTAssertionSpecs.cs b/Tests/FluentAssertions.Specs/Specialized/TaskOfTAssertionSpecs.cs index 4d4c74e796..8e18081243 100644 --- a/Tests/FluentAssertions.Specs/Specialized/TaskOfTAssertionSpecs.cs +++ b/Tests/FluentAssertions.Specs/Specialized/TaskOfTAssertionSpecs.cs @@ -143,6 +143,28 @@ public async Task When_task_completes_late_it_should_fail() await action.Should().ThrowAsync(); } + [Fact] + public async Task When_task_completes_late_it_in_assertion_scope_should_fail() + { + // Arrange + var timer = new FakeClock(); + var taskFactory = new TaskCompletionSource(); + + // Act + Func action = () => + { + Func> func = () => taskFactory.Task; + + using var _ = new AssertionScope(); + return func.Should(timer).CompleteWithinAsync(100.Milliseconds()); + }; + + timer.Complete(); + + // Assert + await action.Should().ThrowAsync(); + } + [Fact] public async Task When_task_consumes_time_in_sync_portion_it_should_fail() {