public void When_A_Message_Is_Dispatched_It_Should_Reach_A_Handler_Async() { AsyncContext.Run(async() => await _messagePump.Run()); Assert.True(MyEventHandlerAsyncWithContinuation.ShouldReceive(_event)); Assert.AreEqual(2, MyEventHandlerAsyncWithContinuation.LoopCounter.Value); Assert.AreEqual(MyEventHandlerAsyncWithContinuation.ContinuationThreadId, MyEventHandlerAsyncWithContinuation.WorkThreadId); }
public async Task When_a_message_is_dispatched_it_should_reach_a_handler_async() { await _messagePump.Run(); MyEventHandlerAsyncWithContinuation.ShouldReceive(_myEvent).Should().BeTrue(); MyEventHandlerAsyncWithContinuation.MonitorValue.Should().Be(2); //NOTE: We may want to run the continuation on the captured context, so as not to create a new thread, which means this test would //change once we fix the pump to exhibit that behavior MyEventHandlerAsyncWithContinuation.WorkThreadId.Should().NotBe(MyEventHandlerAsyncWithContinuation.ContinuationThreadId); }