コード例 #1
0
        public static void UseMessageHandlers(this IApplicationBuilder app, Action <MessageHandlersConfigurationBuilder> configure)
        {
            var builder = new MessageHandlersConfigurationBuilder(app.ApplicationServices);

            configure(builder);
            builder.Build();
        }
コード例 #2
0
        public void Build_HandlerWasAdded_PublishedEventGetsHandledInSystem()
        {
            var builder = new MessageHandlersConfigurationBuilder(serviceProvider);

            builder.AddHandler <SampleMessage, SampleMessageHandler>();
            builder.Build();
            bus.Publish(new SampleMessage());
            Assert.That(handler.Count, Is.EqualTo(1));
        }
コード例 #3
0
        public void Build_DelegateWasAdded_PublishedEventGetsHandledInSystem()
        {
            int counter = 0;
            var builder = new MessageHandlersConfigurationBuilder(serviceProvider);

            builder.AddHandler <SampleMessage>(m => counter++);
            builder.Build();
            bus.Publish(new SampleMessage());
            Assert.That(counter, Is.EqualTo(1));
        }