Skip to content

Commit

Permalink
Fix Failing Unit tests
Browse files Browse the repository at this point in the history
Fix Unit Tests for Sweeper
  • Loading branch information
preardon authored Feb 15, 2022
2 parents 7ad1a91 + d00486a commit 63c10f4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
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

0 comments on commit 63c10f4

Please sign in to comment.