Skip to content

Commit

Permalink
Stabilize unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
petar-m committed Jun 24, 2024
1 parent 17a1b59 commit add5e0e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/M.EventBrokerSlim.Tests/HandlerRegistrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public async Task Handlers_RegisteredWith_AddEventBroker_AreExecuted()

await eventBroker.Publish(testEvent);

var completed = await eventsRecorder.WaitForExpected(timeout: TimeSpan.FromMilliseconds(100));
var completed = await eventsRecorder.WaitForExpected(timeout: TimeSpan.FromMilliseconds(200));

// Assert
Assert.True(completed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task Handler_RegisteredAsTransient_Executed_ByDifferentInstances_An
await eventBroker.Publish(event1);
await eventBroker.Publish(event2);

var completed = await eventsRecorder.WaitForExpected(timeout: TimeSpan.FromMilliseconds(200));
var completed = await eventsRecorder.WaitForExpected(timeout: TimeSpan.FromMilliseconds(300));

// Assert
Assert.True(completed);
Expand Down
6 changes: 3 additions & 3 deletions test/M.EventBrokerSlim.Tests/RetryFromHandleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ public async Task Handle_MultipleRetries_RetriesMultipleTimes_With_GivenDelay(in
// Assert
Assert.Equal(4, eventsTracker.Items.Count);
var timestamps = eventsTracker.Items.OrderBy(x => x.Timestamp).Select(x => x.Timestamp).ToArray();
Assert.Equal(150, (timestamps[1] - timestamps[0]).TotalMilliseconds, tolerance: 60);
Assert.Equal(150, (timestamps[2] - timestamps[1]).TotalMilliseconds, tolerance: 60);
Assert.Equal(150, (timestamps[3] - timestamps[2]).TotalMilliseconds, tolerance: 60);
Assert.Equal(150, (timestamps[1] - timestamps[0]).TotalMilliseconds, tolerance: 65);
Assert.Equal(150, (timestamps[2] - timestamps[1]).TotalMilliseconds, tolerance: 65);
Assert.Equal(150, (timestamps[3] - timestamps[2]).TotalMilliseconds, tolerance: 65);
}

[Theory]
Expand Down

0 comments on commit add5e0e

Please sign in to comment.