private void Get_Pph_PDF_By_Id_NullInvoice(string correctionType) { var Model = this.Model; Model.CorrectionType = correctionType; var ViewModel = this.ViewModel; ViewModel.UseIncomeTax = true; var mockFacade = new Mock <IGarmentReturnCorrectionNoteFacade>(); mockFacade.Setup(x => x.ReadById(It.IsAny <int>())) .Returns(Model); var mockMapper = new Mock <IMapper>(); mockMapper.Setup(x => x.Map <GarmentCorrectionNoteViewModel>(It.IsAny <GarmentCorrectionNote>())) .Returns(ViewModel); var garmentdeliveryOrder = new GarmentDeliveryOrder { DOCurrencyRate = 1, Items = new List <GarmentDeliveryOrderItem> { new GarmentDeliveryOrderItem { Details = Model.Items.Select(i => new GarmentDeliveryOrderDetail { Id = i.DODetailId }).ToList() } } }; var mockGarmentDeliveryOrderFacade = new Mock <IGarmentDeliveryOrderFacade>(); mockGarmentDeliveryOrderFacade.Setup(x => x.ReadById(It.IsAny <int>())) .Returns(garmentdeliveryOrder); var mockGarmentInvoiceFacade = new Mock <IGarmentInvoice>(); mockGarmentInvoiceFacade.Setup(x => x.ReadByDOId(1)) .Returns(new GarmentInvoice()); GarmentReturnCorrectionNoteController controller = GetController(mockFacade, null, mockMapper, mockGarmentDeliveryOrderFacade, null, mockGarmentInvoiceFacade); controller.ControllerContext.HttpContext.Request.Headers["Accept"] = "application/pdf"; var response = controller.GetReturnNotePph(It.IsAny <int>()); Assert.NotNull(response.GetType().GetProperty("FileStream")); }
public void Should_Error_Get_Pph_Data_By_Id() { var mockFacade = new Mock <IGarmentReturnCorrectionNoteFacade>(); mockFacade.Setup(x => x.ReadById(It.IsAny <int>())) .Returns(Model); var mockMapper = new Mock <IMapper>(); GarmentReturnCorrectionNoteController controller = new GarmentReturnCorrectionNoteController(GetServiceProvider().Object, mockMapper.Object, mockFacade.Object); var response = controller.GetReturnNotePph(It.IsAny <int>()); Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response)); }
public void Should_Error_Get_Pph_Data_Invalid_By_Id() { var ViewModel = this.ViewModel; ViewModel.UseIncomeTax = false; var mockFacade = new Mock <IGarmentReturnCorrectionNoteFacade>(); mockFacade.Setup(x => x.ReadById(It.IsAny <int>())) .Returns(Model); var mockMapper = new Mock <IMapper>(); mockMapper.Setup(x => x.Map <GarmentCorrectionNoteViewModel>(It.IsAny <GarmentCorrectionNote>())) .Returns(ViewModel); GarmentReturnCorrectionNoteController controller = GetController(mockFacade, null, mockMapper); var response = controller.GetReturnNotePph(It.IsAny <int>()); Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response)); }