public async Task DeleteShouldSucceed() { // Arrange var id = Guid.NewGuid(); var name = "nameOne"; RepositoryHelper.ForFlow.CreateFlow(id, name); // Act await _repository.DeleteAsync(id, 0); // Assert var data = RepositoryHelper.ForFlow.GetFlows(); data.Should().HaveCount(0); }
public async Task <Result> Handle(DeleteFlowCommand request, CancellationToken cancellationToken) { Result result; try { await _flowWriteRepository.DeleteAsync(request.Id, request.Version); result = Result.Ok(); } catch (EntityNotFoundDbException) { result = Result.Fail(new System.Collections.Generic.List <Failure>() { new HandlerFault() { Code = HandlerFaultCode.NotFound.Name, Message = string.Format(HandlerFailures.NotFound, "Flow"), Target = "id" } } ); } catch (EntityVersionDbException) { result = Result.Fail(new System.Collections.Generic.List <Failure>() { new HandlerFault() { Code = HandlerFaultCode.NotMet.Name, Message = HandlerFailures.NotMet, Target = "version" } } ); } catch { result = Result.Fail(CustomFailures.DeleteFlowFailure); } return(result); }