Example #1
0
        public void Can_resolve_handler()
        {
            var module   = new TestHandlerModule();
            var resolver = new HandlerResolver(module);

            var handlers = resolver.ResolveAll <TestEvent>();

            handlers.Should().HaveCount(1);
        }
Example #2
0
        public void Can_handle_message()
        {
            var module   = new TestHandlerModule();
            var resolver = new HandlerResolver(module);

            IEnumerable <Handler <TestMessage> > handlersFor = resolver.ResolveAll <TestMessage>();

            foreach (var handler in handlersFor)
            {
                handler(new TestMessage(), CancellationToken.None);
            }

            module.MiddlewareCalled.Should().BeTrue();
            module.FinallyCalled.Should().BeTrue();
        }