public void Should_Error_Get_Xls_Report_Out()
        {
            var mockFacade       = new Mock <IGarmentUnitExpenditureNoteFacade>();
            var mockFacadeUnitDO = new Mock <IGarmentUnitDeliveryOrderFacade>();

            var mockMapper = new Mock <IMapper>();


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

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

            controller.ControllerContext = new ControllerContext()
            {
                HttpContext = new DefaultHttpContext()
                {
                    User = user.Object
                }
            };
            //controller.ControllerContext.HttpContext.Request.Headers["x-timezone-offset"] = "0";
            var response = controller.GetXlsMonOut(It.IsAny <DateTime>(), It.IsAny <DateTime>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>());

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

            mockFacade.Setup(x => x.GenerateExcelMonOut(It.IsAny <DateTime>(), It.IsAny <DateTime>(), It.IsAny <string>(), It.IsAny <int>()))
            .Returns(new MemoryStream());

            var mockMapper       = new Mock <IMapper>();
            var mockFacadeUnitDO = new Mock <IGarmentUnitDeliveryOrderFacade>();

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

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

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

            controller.ControllerContext.HttpContext.Request.Headers["x-timezone-offset"] = "0";
            var response = controller.GetXlsMonOut(It.IsAny <DateTime>(), It.IsAny <DateTime>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>());

            Assert.Equal("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", response.GetType().GetProperty("ContentType").GetValue(response, null));
        }