Example #1
0
        public async Task Handle_relays_to_synchronous_action_correctly()
        {
            IFunctionProvider functionProvider = Mock.Of <IFunctionProvider>();
            Action <CommandPublisherExceptionContext> action = functionProvider.Action;
            var sut     = new DelegatingCommandPublisherExceptionHandler(action);
            var fixture = new Fixture();
            CommandPublisherExceptionContext context = fixture.Create <CommandPublisherExceptionContext>();

            await sut.Handle(context);

            Mock.Get(functionProvider).Verify(x => x.Action(context), Times.Once());
        }
Example #2
0
        public async Task Handle_relays_to_asynchronous_action_correctly()
        {
            ICommandPublisherExceptionHandler             handler = Mock.Of <ICommandPublisherExceptionHandler>();
            Func <CommandPublisherExceptionContext, Task> action  = handler.Handle;
            var sut     = new DelegatingCommandPublisherExceptionHandler(action);
            var fixture = new Fixture();
            CommandPublisherExceptionContext context = fixture.Create <CommandPublisherExceptionContext>();

            await sut.Handle(context);

            Mock.Get(handler).Verify(x => x.Handle(context), Times.Once());
        }