public void Should_Fail_Get_Xls_Data() { var mockFacade = new Mock <IGarmentReceiptCorrectionReportFacade>(); var mockMapper = new Mock <IMapper>(); GarmentReceiptCorrectionReportController controller = GetController(mockFacade, null, mockMapper); var response = controller.GetXls(null, null, null, null, 0, 0, ""); Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response)); }
public void Should_Success_Get_Xls_Data() { var mockFacade = new Mock <IGarmentReceiptCorrectionReportFacade>(); mockFacade.Setup(x => x.GenerateExcel(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTimeOffset>(), It.IsAny <DateTimeOffset>(), It.IsAny <string>())) .Returns(new MemoryStream()); var mockMapper = new Mock <IMapper>(); mockMapper.Setup(x => x.Map <List <GarmentReceiptCorrectionReportViewModel> >(It.IsAny <List <GarmentReceiptCorrection> >())) .Returns(new List <GarmentReceiptCorrectionReportViewModel> { ViewModel }); GarmentReceiptCorrectionReportController controller = GetController(mockFacade, null, mockMapper); var response = controller.GetXls(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTimeOffset>(), It.IsAny <DateTimeOffset>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>()); Assert.NotNull(response.GetType().GetProperty("FileDownloadName")); }