public void Should_Success_Get_Data_By_Id() { var mockFacade = new Mock <IUnitPaymentPriceCorrectionNoteFacade>(); mockFacade.Setup(x => x.ReadById(It.IsAny <int>())) .Returns(Model); var mockFacadeSpb = new Mock <IUnitPaymentOrderFacade>(); mockFacadeSpb.Setup(x => x.Read(1, 25, "{}", null, "{}")) .Returns(Tuple.Create(new List <UnitPaymentOrder>(), 0, new Dictionary <string, string>())); var mockMapper = new Mock <IMapper>(); UnitPaymentPriceCorrectionNoteController controller = new UnitPaymentPriceCorrectionNoteController(GetServiceProvider().Object, mockMapper.Object, mockFacade.Object, mockFacadeSpb.Object); var response = controller.Get(It.IsAny <int>()); Assert.Equal((int)HttpStatusCode.OK, GetStatusCode(response)); }
public void Should_Error_Get_All_Data() { var mockFacade = new Mock <IUnitPaymentPriceCorrectionNoteFacade>(); mockFacade.Setup(x => x.Read(1, 25, "{}", null, "{}")) .Returns(Tuple.Create(new List <UnitPaymentCorrectionNote>(), 0, new Dictionary <string, string>())); var mockFacadeSpb = new Mock <IUnitPaymentOrderFacade>(); mockFacadeSpb.Setup(x => x.Read(1, 25, "{}", null, "{}")) .Returns(Tuple.Create(new List <UnitPaymentOrder>(), 0, new Dictionary <string, string>())); var mockMapper = new Mock <IMapper>(); UnitPaymentPriceCorrectionNoteController controller = new UnitPaymentPriceCorrectionNoteController(GetServiceProvider().Object, mockMapper.Object, mockFacade.Object, mockFacadeSpb.Object); var response = controller.Get(1, 25, "{}", null, "{}"); Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response)); }