public void Should_Error_Get_Report_By_User_Xls_Data()
        {
            var mockFacade = new Mock <IGarmentPurchaseRequestFacade>();

            mockFacade.Setup(x => x.GenerateExcelByUserPurchase(null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1, 25, "{}", 7))
            .ReturnsAsync(new MemoryStream());


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

            user.Setup(u => u.Claims).Returns(claims);
            GarmentMonitoringPurchaseController controller = new GarmentMonitoringPurchaseController(GetServiceProvider().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.GetXlsByUser(null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1, 23, "{}");

            Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response.Result));
        }
        public void Should_Error_Get_Report_By_User_Xls_Data()
        {
            var mockFacade = new Mock <IGarmentPurchaseRequestFacade>();

            mockFacade.Setup(x => x.GetMonitoringPurchaseByUserReport(null, null, null, null, null, null, null, null, null, null, null, null, 1, 25, "{}", 7))
            .Returns(Tuple.Create(new List <MonitoringPurchaseAllUserViewModel> {
                ViewModel
            }, 25));

            var mockMapper = new Mock <IMapper>();

            mockMapper.Setup(x => x.Map <List <MonitoringPurchaseAllUserViewModel> >(It.IsAny <List <GarmentPurchaseRequestViewModel> >()))
            .Returns(new List <MonitoringPurchaseAllUserViewModel> {
                ViewModel
            });

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

            user.Setup(u => u.Claims).Returns(claims);
            GarmentMonitoringPurchaseController controller = new GarmentMonitoringPurchaseController(GetServiceProvider().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.GetXlsByUser(null, null, null, null, null, null, null, null, null, null, null, null, 1, 25, "{}");

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