public async Task Delete_Success() { var serviceProvider = GetServiceProvider(); var stockServiceMock = new Mock <IGarmentLeftoverWarehouseStockService>(); stockServiceMock.Setup(s => s.StockIn(It.IsAny <GarmentLeftoverWarehouseStock>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>())) .ReturnsAsync(1); serviceProvider .Setup(x => x.GetService(typeof(IGarmentLeftoverWarehouseStockService))) .Returns(stockServiceMock.Object); GarmentLeftoverWarehouseExpenditureAvalService service = new GarmentLeftoverWarehouseExpenditureAvalService(_dbContext(GetCurrentMethod()), serviceProvider.Object); var data = await _dataUtil(service, GetCurrentMethod()).GetTestDataFabric(); var result = await service.DeleteAsync(data.Id); Assert.NotEqual(0, result); }
public async Task Delete_Error() { GarmentLeftoverWarehouseExpenditureAvalService service = new GarmentLeftoverWarehouseExpenditureAvalService(_dbContext(GetCurrentMethod()), GetServiceProvider().Object); await Assert.ThrowsAnyAsync <Exception>(() => service.DeleteAsync(0)); }