public void Should_Success_GetReport()
        {
            //Setup
            var serviceProviderMock = GetServiceProvider();
            var facadeMock          = new Mock <IGarmentInternalPurchaseOrderFacade>();

            facadeMock
            .Setup(x => x.GetIPOEPODurationReport(null, It.IsAny <string>(), null, null, It.IsAny <int>(), It.IsAny <int>(), "{}", It.IsAny <int>()))
            .Returns(Tuple.Create(new List <GarmentInternalPurchaseOrderExternalPurchaseOrderDurationReportViewModel> {
                ViewModel
            }, 25));

            var mapperMock = new Mock <IMapper>();

            mapperMock
            .Setup(x => x.Map <List <GarmentInternalPurchaseOrderExternalPurchaseOrderDurationReportViewModel> >(It.IsAny <List <GarmentInternalPurchaseOrder> >()))
            .Returns(new List <GarmentInternalPurchaseOrderExternalPurchaseOrderDurationReportViewModel> {
                ViewModel
            });

            //Act
            GarmentInternalPurchaseOrderExternalPurchaseOrderDurationReportController controller = GetController(serviceProviderMock, mapperMock, facadeMock);
            var response = controller.GetReport(null, It.IsAny <string>(), null, null, 1, 25, "{}");

            //Assert
            Assert.Equal((int)HttpStatusCode.OK, GetStatusCode(response));
        }
        public void Should_Success_Get_Report_Data()
        {
            var mockFacade = new Mock <IGarmentInternalPurchaseOrderFacade>();

            mockFacade.Setup(x => x.GetIPOEPODurationReport(null, It.IsAny <string>(), null, null, It.IsAny <int>(), It.IsAny <int>(), "{}", It.IsAny <int>()))
            .Returns(Tuple.Create(new List <GarmentInternalPurchaseOrderExternalPurchaseOrderDurationReportViewModel> {
                ViewModel
            }, 25));

            var mockMapper = new Mock <IMapper>();

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

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

            user.Setup(u => u.Claims).Returns(claims);
            GarmentInternalPurchaseOrderExternalPurchaseOrderDurationReportController controller = new GarmentInternalPurchaseOrderExternalPurchaseOrderDurationReportController(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.GetReport(null, It.IsAny <string>(), null, null, 1, 25, "{}");

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