Description
I have two equivalent tests of function that returns Task. First one uses CompleteWithinAsync() method, second one ExecutionTime(). Inside function before async part there is some sync code, but for simplicity of example I changed it to Thread.Sleep().
[Fact]
public async Task Test1()
{
var func = async () => Thread.Sleep(10);
await func.Should().CompleteWithinAsync(1.Milliseconds());
}
[Fact]
public void Test2()
{
var func = async () => Thread.Sleep(10);
func.ExecutionTime().Should().BeLessThan(1.Milliseconds());
}
Expected behavior:
Two tests fail.
Actual behavior:
First test does not fail.
Versions
I'm using Fluent Assertions version 6.2.0 with net6.0 and c# 9.