public async Task PurchaseApplicationService_AddItemAsync_DeveFecharCorretamenteORegistroQuandoEncontrarMesmo__() { // Arange ConfigureMock(); FactoryService(); AddOrUpdatePurchaseItemDto addOrUpdatePurchaseItemDto = AddOrUpdatePurchaseItemDtoFaker.GenerateValidFaker().Generate(); throw new Exception("TODO"); // Act ApplicationDataResult <PurchaseItemDto> result = await _purchaseApplicationService.AddItemAsync(addOrUpdatePurchaseItemDto.PurchaseId, addOrUpdatePurchaseItemDto); // Assert result.IsSuccess.Should().BeTrue(); result.Errors.Should().BeEmpty(); result.Data.Should().NotBeNull(); }
public async Task PurchaseApplicationService_AddAsync_DeveRetornarErrosDeValidacaoQuandoEmEstadoInvalido() { // Arange ConfigureMock(); FactoryService(); AddOrUpdatePurchaseDto addOrUpdatePurchaseDto = AddOrUpdatePurchaseDtoFaker.GenerateInvalidFaker().Generate(); // Act ApplicationDataResult <PurchaseDto> result = await _purchaseApplicationService.AddAsync(addOrUpdatePurchaseDto); // Assert result.IsSuccess.Should().BeFalse(); result.Errors.Should().HaveCount(3); result.Data.Should().BeNull(); _purchaseRepositoryMock.Verify(x => x.AddAsync(It.IsAny <Purchase>()), Times.Never); _unitOfWork.Verify(x => x.CommitAsync(), Times.Never); }
public async Task PurchaseApplicationService_AddAsync_DeveCriarCorretamenteORegistroQuandoEmEstadoValido() { // Arange ConfigureMock(); FactoryService(); AddOrUpdatePurchaseDto addOrUpdatePurchaseDto = AddOrUpdatePurchaseDtoFaker.GenerateValidFaker().Generate(); // Act ApplicationDataResult <PurchaseDto> result = await _purchaseApplicationService.AddAsync(addOrUpdatePurchaseDto); // Assert result.IsSuccess.Should().BeTrue(); result.Errors.Should().BeEmpty(); result.Data.Should().NotBeNull(); _purchaseRepositoryMock.Verify(x => x.AddAsync(It.IsAny <Purchase>()), Times.Once); _unitOfWork.Verify(x => x.CommitAsync(), Times.Once); }