public void ReceiveMessage_StressTest() { using (var bus = new DataBus()) { using (var executionContext = new TestExecutionContext(bus)) { DatabusExecutionContext.SetExecutionContext(executionContext); bus.Start(); for (int i = 0; i < 1000; i++) { executionContext.Publish <TestMessage>(new { Message = "Hello Test World!" }) .Wait(message => Console.Out.WriteLineAsync(message.Message)); } } } }
public void ReceiveMessage_Test() { using (var bus = new DataBus()) { using (var executionContext = new TestExecutionContext(bus)) { DatabusExecutionContext.SetExecutionContext(executionContext); bus.Start(); executionContext.Publish <TestMessage>(new { Message = "Hello Test World!" }).Wait(message => { Assert.AreEqual("Hello Test World!", message.Message); return(Console.Out.WriteLineAsync(message.Message)); }); } } }