public async Task When_no_exception_should_be_thrown_on_UI_thread_for_async_func_after_wait_time_but_it_was_it_should_throw() { // Arrange var waitTime = 2.Seconds(); var pollInterval = 10.Milliseconds(); var clock = new FakeClock(); var timer = clock.StartTimer(); clock.CompleteAfter(waitTime); Func <Task> throwLongerThanWaitTime = async() => { if (timer.Elapsed <= waitTime.Multiply(1.5)) { throw new ArgumentException("An exception was forced"); } await Task.Yield(); }; // Act Func <Task> action = () => throwLongerThanWaitTime.Should(clock) .NotThrowAfterAsync(waitTime, pollInterval, "we passed valid arguments"); // Assert await action.Should().ThrowAsync <XunitException>() .WithMessage("Did not expect any exceptions after 2s because we passed valid arguments*"); }