Skip to content

Commit

Permalink
Yet another try to avoid race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Kralizek committed Sep 13, 2015
1 parent 20f606d commit 3631ffc
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/Tests.MassTransit/MassTransit/MassTransitBusEngineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,14 @@ public async Task TEvent_ErroryStrategy_is_invoked_when_handler_throws()

sut.SubscribeToEvent<TestEvent>(msg =>
{
lock (lockObject)
try
{
are.Set();
throw exception;
}
finally
{
are.Set();
}
});

var message = fixture.Create<EventMessage<TestEvent>>();
Expand All @@ -293,6 +296,8 @@ public async Task TEvent_ErroryStrategy_is_invoked_when_handler_throws()

are.WaitOne();

await Task.Delay(TimeSpan.FromSeconds(2));

mockEventErrorStrategy.Verify(p => p.HandleError(It.IsAny<IConsumeContext<EventMessage<TestEvent>>>(), exception), Times.AtLeastOnce);
}

Expand Down Expand Up @@ -345,11 +350,14 @@ public async Task TCommand_ErroryStrategy_is_invoked_when_handler_throws()

sut.SubscribeToCommand<TestCommand>(msg =>
{
lock (lockObject)
try
{
are.Set();
throw exception;
}
finally
{
are.Set();
}
});

var message = fixture.Create<CommandMessage<TestCommand>>();
Expand All @@ -360,6 +368,8 @@ public async Task TCommand_ErroryStrategy_is_invoked_when_handler_throws()

are.WaitOne();

await Task.Delay(TimeSpan.FromSeconds(2));

mockCommandErrorStrategy.Verify(p => p.HandleError(It.IsAny<IConsumeContext<CommandMessage<TestCommand>>>(), exception), Times.AtLeastOnce);
}

Expand Down

0 comments on commit 3631ffc

Please sign in to comment.