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); serviceProvider .Setup(x => x.GetService(typeof(IHttpService))) .Returns(new HttpTestService()); GarmentLeftoverWarehouseReceiptFinishedGoodService service = new GarmentLeftoverWarehouseReceiptFinishedGoodService(_dbContext(GetCurrentMethod()), serviceProvider.Object); var data = await _dataUtil(service).GetTestData(); var result = await service.DeleteAsync(data.Id); Assert.NotEqual(0, result); }
public async Task Delete_Error() { GarmentLeftoverWarehouseReceiptFinishedGoodService service = new GarmentLeftoverWarehouseReceiptFinishedGoodService(_dbContext(GetCurrentMethod()), GetServiceProvider().Object); await Assert.ThrowsAnyAsync <Exception>(() => service.DeleteAsync(0)); }