public async Task StorageLocation_UpdateAsync() { var storageLocationViewModel = _fixture.Create <StorageLocationUpdateViewModel>(); var storageLocation = _fixture.Create <StorageLocation>(); _mockStorageLocationRepository.Setup(m => m.UpdateAsync(storageLocation)).ReturnsAsync(1); _mockIMapper.Setup(m => m.Map <StorageLocationUpdateViewModel, StorageLocation>(storageLocationViewModel)).Returns(storageLocation); var actionSuccess = await _storageLocationService.UpdateAsync(storageLocationViewModel); actionSuccess.Should().Be(true); Mock.VerifyAll(); }
public async Task <IActionResult> UpdateStorageLocation(StorageLocationUpdateViewModel storageLocation) { try { var success = await _storageLocationService.UpdateAsync(storageLocation); if (success) { return(NoContent()); } return(BadRequest($"Erro ao atualizar produto")); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex)); } }