public async Task DiscoveredBusAsynchronousConsumerAsynchronouslyConsumesCorrectly() { var bus = new Bus(); var directory = Path.GetDirectoryName(new Uri(GetType().GetTypeInfo().Assembly.CodeBase).LocalPath); bus.AddHandlersAndTranslators(directory, "Tests*.dll", GetType().Namespace); var message3 = new Message3 { CorrelationId = "1234" }; await bus.HandleAsync(message3); Assert.NotNull(Message3AsyncConsumer.LastMessageReceived); Assert.Equal(message3.CorrelationId, Message3AsyncConsumer.LastMessageReceived.CorrelationId); }
public async Task ManuallyComposedAsyncTypeAsynchronouslyHandlesMessageProperly() { var message3 = new Message3 { CorrelationId = "1234" }; var bus = new Bus(); var message3AsyncConsumer = new Message3AsyncConsumer(); bus.AddHandler(message3AsyncConsumer); await bus.HandleAsync(message3); Assert.IsNotNull(Message3AsyncConsumer.LastMessageReceived); Assert.AreEqual(message3.CorrelationId, Message3AsyncConsumer.LastMessageReceived.CorrelationId); }
public async Task ManuallyComposedSyncAsyncTypeAsynchronouslyHandlesMessageProperly() { var message2 = new Message2 { CorrelationId = "1234" }; var bus = new Bus(); var message3AsyncConsumer = new Message3AsyncConsumer(); bus.AddHandler(message3AsyncConsumer); var pipe = new Pipe23(); bus.AddTranslator(pipe); await bus.HandleAsync(message2); Assert.AreSame(message2, Pipe23.LastMessageProcessed); Assert.IsNotNull(Message3AsyncConsumer.LastMessageReceived); Assert.AreEqual(message2.CorrelationId, Message3AsyncConsumer.LastMessageReceived.CorrelationId); }