Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Unit Tests for Sweeper #1989

Merged
merged 2 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task When_outstanding_in_outbox_they_are_retrieved_correctly_async(
await outbox.AddAsync(new MessageTestDataBuilder());
await outbox.AddAsync(new MessageTestDataBuilder());

await Task.Delay(minimumAgeInMs);
await Task.Delay(minimumAgeInMs * 2);

await outbox.AddAsync(new MessageTestDataBuilder());
await outbox.AddAsync(new MessageTestDataBuilder());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void When_outstanding_in_outbox_sweep_clears_them()
Task.Delay(1000).Wait(); // -- let the messages expire

sweeper.Sweep();

//Assert
outbox.EntryCount.Should().Be(3);
commandProcessor.Dispatched.Count.Should().Be(3);
Expand All @@ -61,10 +61,10 @@ public async Task When_outstanding_in_outbox_sweep_clears_them_async()
}

//Act
Task.Delay(1000).Wait(); // -- let the messages expire
await Task.Delay(milliSecondsSinceSent * 2); // -- let the messages expire

await sweeper.SweepAsync();

//Assert
outbox.EntryCount.Should().Be(3);
commandProcessor.Dispatched.Count.Should().Be(3);
Expand All @@ -86,7 +86,7 @@ public void When_too_new_to_sweep_leaves_them()

var messages = new Message[] {new MessageTestDataBuilder(), new MessageTestDataBuilder(), new MessageTestDataBuilder()};

Thread.Sleep(milliSecondsSinceSent);
Thread.Sleep(milliSecondsSinceSent * 2);

foreach (var message in messages)
{
Expand All @@ -95,7 +95,7 @@ public void When_too_new_to_sweep_leaves_them()

//Act
sweeper.Sweep();

//Assert
commandProcessor.Dispatched.Count.Should().Be(1);
commandProcessor.Deposited.Count.Should().Be(4);
Expand All @@ -116,7 +116,7 @@ public async Task When_too_new_to_sweep_leaves_them_async()

var messages = new Message[] {new MessageTestDataBuilder(), new MessageTestDataBuilder(), new MessageTestDataBuilder()};

await Task.Delay(milliSecondsSinceSent);
await Task.Delay(milliSecondsSinceSent * 2);

foreach (var message in messages)
{
Expand All @@ -125,11 +125,11 @@ public async Task When_too_new_to_sweep_leaves_them_async()

//Act
await sweeper.SweepAsync();

//Assert
commandProcessor.Dispatched.Count.Should().Be(1);
commandProcessor.Deposited.Count.Should().Be(4);

commandProcessor.Dispatched.Count.Should().Be(1);

}

}
Expand Down