예제 #1
0
        public void Publish_CallsDecorators()
        {
            var decorator1 = new MyDecorator();
            var decorator2 = new MyDecorator();

            var bus = new Bus(new MockHandlerProvider(), new MockDecoratorProvider(new[] { decorator1, decorator2 }));

            bus.Publish(new MyEvent());

            decorator1.Count.Should().Be(1);
            decorator2.Count.Should().Be(1);
        }
예제 #2
0
        public void Send_Command_CallsDecorators()
        {
            var decorator1 = new MyDecorator();
            var decorator2 = new MyDecorator();

            var bus = new Bus(
                new MockHandlerProvider(null, new MyCommandHandler()),
                new MockDecoratorProvider(new[] { decorator1, decorator2 })
                );

            bus.Send(new MyCommand());

            decorator1.Count.Should().Be(1);
            decorator2.Count.Should().Be(1);
        }