Ejemplo n.º 1
0
        public void Handle_Command_With_Context_Handler()
        {
            var fakeCommand = new Command();
            var fakeContext = new CommandContext();

            var handler = new Mock <ICommandHandler <Command, CommandContext> >();

            handler.Setup(x => x.Handle(fakeCommand, fakeContext));

            _mockHandlerFactory
            .Setup(x => x.Resolve(typeof(ICommandHandler <Command, CommandContext>)))
            .Returns(handler.Object);

            _dispatcher.Handle(fakeCommand, fakeContext);
        }
        protected override void Assert()
        {
            var eventBus   = Substitute.For <IEventBus>();
            var commandBus = new CommandBus();
            var sut        = new RequestCleaningHandler(eventBus);

            commandBus.Subscribe(sut);
            commandBus.Handle(when);
            foreach (var evt in then)
            {
                eventBus.Received().Publish(evt);
            }
        }