Exemplo n.º 1
0
        private async Task <CommandBusResult> Execute(ICommandPipeline pipeline, ICommand cmd)
        {
            InMemoryCommandBus sut    = GetSut(pipeline);
            CommandBusResult   result = await sut.EnqueueAsync(cmd);

            return(result);
        }
Exemplo n.º 2
0
        public async Task ItIndicatesFail()
        {
            CommandBusResult result = await Execute();

            Assert.False(result.WasSuccessfull);
            Assert.False(result.WasFiltered);
            Assert.False(result.WasExecuted);
        }
Exemplo n.º 3
0
        public async Task ItIndicatesSucesss()
        {
            var cmd      = new SampleCommand();
            var pipeline = A.Fake <ICommandPipeline>();

            CommandBusResult result = await Execute(pipeline, cmd);

            Assert.True(result.WasSuccessfull);
        }
Exemplo n.º 4
0
        public async Task ItDoesNothingWhenCondingIsNotMet()
        {
            var pipeline = A.Fake <ICommandPipeline>();

            var command = new SampleCommand
            {
                Value = 5
            };

            CommandBusResult result = await Execute(pipeline, command);

            Assert.False(result.WasSuccessfull);
        }
Exemplo n.º 5
0
        public async Task ItExecutesWhenConditionIsFullfilled()
        {
            var pipeline = A.Fake <ICommandPipeline>();

            var command = new SampleCommand
            {
                Value = 42
            };

            CommandBusResult result = await Execute(pipeline, command);

            Assert.True(result.WasSuccessfull);
        }
Exemplo n.º 6
0
        private async Task <CommandBusResult> Execute()
        {
            CommandBusResult result = await sut.EnqueueAsync(new SampleCommand());

            return(result);
        }
Exemplo n.º 7
0
        public async Task ItHasAException()
        {
            CommandBusResult result = await Execute();

            Assert.NotNull(result.Exception);
        }