public async Task Should_Success_GetReportT()
        {
            var serviceProvider = GetServiceProvider();

            var stockServiceMock = new Mock <IGarmentLeftoverWarehouseStockService>();

            stockServiceMock.Setup(s => s.StockOut(It.IsAny <GarmentLeftoverWarehouseStock>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>()))
            .ReturnsAsync(1);

            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 dataFinishedGood = _dataUtilFinishedGood(service).GetNewData();

            dataFinishedGood.ReceiptDate = dataFinishedGood.ReceiptDate.AddDays(-1);

            await service.CreateAsync(dataFinishedGood);

            var result = service.GetMonitoring(null, DateTime.Now, 1, 1, "{}", 7);


            Assert.NotNull(result);
        }
        public async Task Should_Success_GetReportT_InternalServerError()
        {
            var serviceProvider1 = GetServiceProvider();

            var stockServiceMock = new Mock <IGarmentLeftoverWarehouseStockService>();

            stockServiceMock.Setup(s => s.StockOut(It.IsAny <GarmentLeftoverWarehouseStock>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>()))
            .ReturnsAsync(1);

            stockServiceMock.Setup(s => s.StockIn(It.IsAny <GarmentLeftoverWarehouseStock>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>()))
            .ReturnsAsync(1);



            serviceProvider1
            .Setup(x => x.GetService(typeof(IGarmentLeftoverWarehouseStockService)))
            .Returns(stockServiceMock.Object);

            serviceProvider1
            .Setup(x => x.GetService(typeof(IHttpService)))
            .Returns(new HttpTestService());

            var serviceProvider = new Mock <IServiceProvider>();

            var httpClientService             = new Mock <IHttpService>();
            HttpResponseMessage messageunitdo = new HttpResponseMessage(System.Net.HttpStatusCode.OK);

            messageunitdo.Content = new StringContent("{\"apiVersion\":\"1.0\",\"statusCode\":200,\"message\":\"Ok\",\"data\":[{\"POSerialNumber\":\"PONo\",\"ProductCode\":\"ProductCode\",\"ProductName\":\"FABRIC\",\"BeacukaiDate\":\"2018/10/20\"},{\"POSerialNumber\":\"PONo123\",\"ProductCode\":\"ProductCode\",\"ProductName\":\"FABRIC\",\"BeacukaiDate\":\"2018/10/20\"}]}}");


            HttpResponseMessage messagebc = new HttpResponseMessage(System.Net.HttpStatusCode.OK);

            messagebc.Content = new StringContent("{\"apiVersion\":\"1.0\",\"statusCode\":200,\"message\":\"Ok\",\"data\":[{\"POSerialNumber\":\"PONo\",\"customnos\":[{}]\"ProductCode\",\"ProductName\":\"FABRIC\",\"BeacukaiDate\":\"2018/10/20\"},{\"POSerialNumber\":\"PONo123\",\"ProductCode\":\"ProductCode\",\"ProductName\":\"FABRIC\",\"BeacukaiDate\":\"2018/10/20\"}]}}");

            httpClientService
            .Setup(x => x.SendAsync(It.IsAny <HttpMethod>(), It.Is <string>(s => s.Contains("garment-beacukai/by-poserialnumbers")), It.IsAny <StringContent>()))
            .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.InternalServerError));

            httpClientService
            .Setup(x => x.SendAsync(It.IsAny <HttpMethod>(), It.Is <string>(s => s.Contains("garment-unit-delivery-orders/leftoverwarehouse")), It.IsAny <StringContent>()))
            .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.InternalServerError));

            httpClientService
            .Setup(x => x.PutAsync(It.Is <string>(s => s.Contains("update-received")), It.IsAny <StringContent>()))
            .ReturnsAsync(messageunitdo);

            serviceProvider
            .Setup(x => x.GetService(typeof(IIdentityService)))
            .Returns(new IdentityService()
            {
                Token = "Token", Username = "******"
            });

            serviceProvider
            .Setup(x => x.GetService(typeof(IHttpService)))
            .Returns(httpClientService.Object);

            serviceProvider
            .Setup(x => x.GetService(typeof(IGarmentLeftoverWarehouseStockService)))
            .Returns(stockServiceMock.Object);

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


            var dataFinishedGood = _dataUtilFinishedGood(service).GetNewData();

            dataFinishedGood.ReceiptDate = dataFinishedGood.ReceiptDate.AddDays(-1);

            await service.CreateAsync(dataFinishedGood);

            var result = service.GetMonitoring(null, DateTime.Now, 1, 25, "{}", 7);


            Assert.NotNull(result);
        }