Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions tests/TUnit.Assertions.Tests/WaitsForAssertionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ public class WaitsForAssertionTests
[Test]
public async Task WaitsFor_Passes_Immediately_When_Assertion_Succeeds()
{
var stopwatch = Stopwatch.StartNew();

var value = 42;
var attemptCount = 0;

await Assert.That(value).WaitsFor(
assert => assert.IsEqualTo(42),
assert =>
{
attemptCount++;
return assert.IsEqualTo(42);
},
timeout: TimeSpan.FromSeconds(5));

stopwatch.Stop();

// Should complete very quickly since assertion passes immediately
await Assert.That(stopwatch.Elapsed).IsLessThan(TimeSpan.FromMilliseconds(100));
await Assert.That(attemptCount).IsEqualTo(1);
}

[Test]
Expand Down
Loading