public void Execution_time_should_not_exceed_example() { var subject = new SomePotentiallyVerySlowClass(); // subject.ExecutionTimeOf(s => s.ExpensiveMethod()).ShouldNotExceed(1000.Milliseconds()); // subject.ExecutionTimeOf(s => s.ExpensiveMethod()).Should().BeGreaterThan(new TimeSpan(0, 0, 0, 1)); // to be fixed because it was ok with fluent assertion V4 and not with V5.15 Action someAction = () => Thread.Sleep(510); // someAction.ExecutionTime().shouShouldNotExceed(1000.Milliseconds()); // someAction.ExecutionTime().Should().BeGreaterThan(new TimeSpan(0, 0, 0, 1)); }
public void FluentAssertions_Can_Check_Execution_Time_Of_Methods() { var sut = new SomePotentiallyVerySlowClass(); sut.ExecutionTimeOf(s => s.ExpensiveMethod()).ShouldNotExceed(500.Milliseconds()); }