public void Send_Should_send_to_single_receiver() { var concreteMessageA = new ConcreteMessageA(); UnitUnderTest.Send(concreteMessageA); concreteMessageA.Data.Should().Contain(new[] { "HandlerA.Handle<ConcreteMessageA>" }); }
public async Task SendAsync_Should_send_to_single_receiver() { var concreteMessageA = new ConcreteMessageA(); await UnitUnderTest.SendAsync(concreteMessageA); concreteMessageA.Data.Should().Contain(new[] { "HandlerA.HandleAsync<ConcreteMessageA>" }); }
public async Task Should_invoke_OnBeforeRouting_and_OnAfterRouter_and_pass_state_When_specified() { var theState = Guid.NewGuid(); var interceptedMatchingState = false; UnitUnderTest.OnBeforeRouting = envelope => envelope.SetState("TheState", theState); UnitUnderTest.OnAfterRouted = envelope => interceptedMatchingState = Equals(envelope.GetState("TheState"), theState); var concreteMessageA = new ConcreteMessageA(); await UnitUnderTest.RouteAsync(concreteMessageA); interceptedMatchingState.Should().BeTrue(); }
public async Task Should_route() { var concreteMessageA = new ConcreteMessageA(); var concreteMessageB = new ConcreteMessageB(); await UnitUnderTest.RouteAsync(concreteMessageA); await UnitUnderTest.RouteAsync(concreteMessageB); concreteMessageA.Data.Should().Contain(new[] { "HandlerA.HandleAsync<ConcreteMessageA>", "HandlerB.HandleAsync<ConcreteMessageA>" }); concreteMessageB.Data.Should().Contain(new[] { "HandlerA.HandleAsync<ConcreteMessageB>", "HandlerB.HandleAsync<ConcreteMessageB>" }); }