public void Should_Success_Get_Report_Xls_Data_Detail_AccuracyArrival()
        {
            List <GarmentCategoryViewModel> garmentCategory = new List <GarmentCategoryViewModel>
            {
                new GarmentCategoryViewModel
                {
                    Id              = 7,
                    Code            = "LBL",
                    Name            = "LABEL",
                    CodeRequirement = "BP"
                },
                new GarmentCategoryViewModel
                {
                    Id              = 13,
                    Code            = "SUB",
                    Name            = "SUBKON",
                    CodeRequirement = "BB"
                }
            };
            long   nowTicks  = DateTimeOffset.Now.Ticks;
            string nowTicksA = $"{nowTicks}a";

            var mockFacade = new Mock <IGarmentDeliveryOrderFacade>();

            mockFacade.Setup(x => x.GetReportDetailAccuracyofArrival($"BuyerCode{nowTicksA}", null, null, null, It.IsAny <int>()))
            .Returns(Tuple.Create(new List <AccuracyOfArrivalReportViewModel> {
                this.ViewModelAccuracyArrival
            }, 25));

            var mockMapper = new Mock <IMapper>();

            mockMapper.Setup(x => x.Map <List <AccuracyOfArrivalReportViewModel> >(It.IsAny <List <GarmentDeliveryOrder> >()))
            .Returns(new List <AccuracyOfArrivalReportViewModel> {
                this.ViewModelAccuracyArrival
            });

            var user   = new Mock <ClaimsPrincipal>();
            var claims = new Claim[]
            {
                new Claim("username", "unittestusername")
            };

            user.Setup(u => u.Claims).Returns(claims);
            GarmentDeliveryOrderController controller = new GarmentDeliveryOrderController(GetServiceProvider().Object, mockMapper.Object, mockFacade.Object);

            controller.ControllerContext = new ControllerContext()
            {
                HttpContext = new DefaultHttpContext()
                {
                    User = user.Object
                }
            };
            var vmString = JsonConvert.SerializeObject(garmentCategory);

            controller.ControllerContext.HttpContext.Request.Headers["x-timezone-offset"] = "0";
            var response = controller.GetXlsArrivalDetail($"BuyerCode{nowTicksA}", null, null, null);

            Assert.Null(response.GetType().GetProperty("FileStream"));
        }
        public void Should_Error_Get_Report_Xls_Data_Detail_AccuracyArrival()
        {
            long   nowTicks  = DateTimeOffset.Now.Ticks;
            string nowTicksA = $"{nowTicks}a";

            var mockFacade = new Mock <IGarmentDeliveryOrderFacade>();

            mockFacade.Setup(x => x.GetReportDetailAccuracyofArrival($"BuyerCode{nowTicksA}", null, null, null, It.IsAny <int>()))
            .Returns(Tuple.Create(new List <AccuracyOfArrivalReportViewModel> {
                this.ViewModelAccuracyArrival
            }, 25));

            var mockMapper = new Mock <IMapper>();

            mockMapper.Setup(x => x.Map <List <AccuracyOfArrivalReportViewModel> >(It.IsAny <List <GarmentDeliveryOrder> >()))
            .Returns(new List <AccuracyOfArrivalReportViewModel> {
                this.ViewModelAccuracyArrival
            });

            var user   = new Mock <ClaimsPrincipal>();
            var claims = new Claim[]
            {
                new Claim("username", "unittestusername")
            };

            user.Setup(u => u.Claims).Returns(claims);
            GarmentDeliveryOrderController controller = new GarmentDeliveryOrderController(GetServiceProvider().Object, mockMapper.Object, mockFacade.Object);

            controller.ControllerContext = new ControllerContext()
            {
                HttpContext = new DefaultHttpContext()
                {
                    User = user.Object
                }
            };

            controller.ControllerContext.HttpContext.Request.Headers["x-timezone-offset"] = "0";
            var response = controller.GetXlsArrivalDetail($"BuyerCode{nowTicksA}", null, null, null);

            Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response));
        }