public void Should_Error_Get_Data_By_Id() { var mockFacade = new Mock <IBalanceDebtFacade>(); mockFacade.Setup(x => x.ReadById(It.IsAny <int>())) .Returns(new GarmentSupplierBalanceDebt()); var mockMapper = new Mock <IMapper>(); GarmentSupplierBalanceDebtController controller = new GarmentSupplierBalanceDebtController(mockFacade.Object, mockMapper.Object, GetServiceProvider().Object); var response = controller.Get(It.IsAny <int>()); Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response)); }
public void Should_Error_Get_All_Data() { var mockFacade = new Mock <IBalanceDebtFacade>(); mockFacade.Setup(x => x.Read(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), null, It.IsAny <string>())) .Returns(Tuple.Create(new List <GarmentSupplierBalanceDebt>(), 0, new Dictionary <string, string>())); var mockMapper = new Mock <IMapper>(); mockMapper.Setup(x => x.Map <List <GarmentSupplierBalanceDebtViewModel> >(It.IsAny <List <GarmentSupplierBalanceDebt> >())) .Returns(new List <GarmentSupplierBalanceDebtViewModel> { viewModel }); GarmentSupplierBalanceDebtController controller = new GarmentSupplierBalanceDebtController(mockFacade.Object, mockMapper.Object, GetServiceProvider().Object); var response = controller.Get(); Assert.Equal((int)HttpStatusCode.InternalServerError, GetStatusCode(response)); }