コード例 #1
0
        public async Task Read_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());

            GarmentLeftoverWarehouseExpenditureAvalService service = new GarmentLeftoverWarehouseExpenditureAvalService(_dbContext(GetCurrentMethod()), serviceProvider.Object);

            await _dataUtil(service, GetCurrentMethod()).GetTestDataFabric();

            var result = service.Read(1, 25, "{}", null, null, "{}");

            Assert.NotEmpty(result.Data);
        }