public void Should_Error_Get_Loader() { var mockFacade = new Mock <IBalanceDebtFacade>(); mockFacade.Setup(x => x.ReadLoader(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <int>(), null, It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Throws(new Exception()); var mockMapper = new Mock <IMapper>(); GarmentSupplierBalanceDebtController controller = GetController(mockFacade, null, mockMapper); var response = controller.GetLoader(); Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response)); }
public void Should_Success_Get_Loader_With_year() { var mockFacade = new Mock <IBalanceDebtFacade>(); mockFacade.Setup(x => x.ReadLoader(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <int>(), null, It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(new ReadResponse <dynamic>(new List <dynamic>(), 1, new Dictionary <string, string>())); var mockMapper = new Mock <IMapper>(); GarmentSupplierBalanceDebtController controller = GetController(mockFacade, null, mockMapper); var response = controller.GetLoader(year: DateTime.Now.Year); Assert.Equal((int)HttpStatusCode.OK, GetStatusCode(response)); }