Exemplo n.º 1
0
        public async Task ShouldExecuteCommand()
        {
            var args = new FakeCommandArgs();
            await _bus.ExecuteAsync(args);

            Assert.True(args.DidExecute);
        }
Exemplo n.º 2
0
        public async Task ShouldLogInfoWhenExecutingACommand()
        {
            var args = new FakeCommandArgs();
            await _bus.ExecuteAsync(args);

            Assert.True(args.DidExecute);
            Assert.Equal(2, _logger.GetMessages(LogLevel.Information).Length);
        }
Exemplo n.º 3
0
        public async Task ShouldCreateBusWithoutServiceCollection()
        {
            var bus = CqrsBus.UseAssembly(typeof(FakeCommandArgs).Assembly).Build();

            var args = new FakeCommandArgs();
            await bus.ExecuteAsync(args);

            Assert.True(args.DidExecute);
        }
Exemplo n.º 4
0
        public async Task ShouldUseCommandsForAssemblyContainingType()
        {
            var bus = CqrsBus.UseAssemblyFor <FakeLogger>()
                      .Build();

            var args = new FakeCommandArgs();

            await bus.ExecuteAsync(args);

            Assert.True(args.DidExecute);
        }