Пример #1
0
        public async Task Should_set_succeeded_if_handler_marks_completed()
        {
            var handler = new HandledHandler();

            var sut = new InMemoryCommandBus(new ICommandMiddleware[] { handler });
            var ctx = await sut.PublishAsync(command);

            Assert.Equal(command, handler.LastCommand);
            Assert.True(ctx.IsCompleted);
        }
        public async Task Should_set_succeeded_if_handler_returns_true()
        {
            var handler = new HandledHandler();

            var sut = new InMemoryCommandBus(new ICommandHandler[] { handler });
            var ctx = await sut.PublishAsync(command);

            Assert.Equal(command, handler.LastCommand);
            Assert.True(ctx.IsSucceeded);
            Assert.True(ctx.IsHandled);
            Assert.Null(ctx.Exception);
        }