コード例 #1
0
        public void Send_Should_send_to_single_receiver()
        {
            var concreteMessageA = new ConcreteMessageA();

            UnitUnderTest.Send(concreteMessageA);

            concreteMessageA.Data.Should().Contain(new[]
            {
                "HandlerA.Handle<ConcreteMessageA>"
            });
        }
コード例 #2
0
        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>"
            });
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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>"
            });
        }