private async Task <CommandBusResult> Execute(ICommandPipeline pipeline, ICommand cmd) { InMemoryCommandBus sut = GetSut(pipeline); CommandBusResult result = await sut.EnqueueAsync(cmd); return(result); }
public async Task ItIndicatesFail() { CommandBusResult result = await Execute(); Assert.False(result.WasSuccessfull); Assert.False(result.WasFiltered); Assert.False(result.WasExecuted); }
public async Task ItIndicatesSucesss() { var cmd = new SampleCommand(); var pipeline = A.Fake <ICommandPipeline>(); CommandBusResult result = await Execute(pipeline, cmd); Assert.True(result.WasSuccessfull); }
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); }
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); }
private async Task <CommandBusResult> Execute() { CommandBusResult result = await sut.EnqueueAsync(new SampleCommand()); return(result); }
public async Task ItHasAException() { CommandBusResult result = await Execute(); Assert.NotNull(result.Exception); }