public void ServiceShouldReturnData() { var mortgages = mortgageService.GetAllMortgages(); Assert.IsNotNull(mortgages, "Mortgage Data should not be null."); Assert.IsTrue(mortgages.Count > 0, "Mortgage Data count should not be zero."); Assert.IsTrue(mortgages.Count == 8, "Mortgage Data count should be eight."); }
public void Mortgage_Get_All() { _mockRepository.Setup(x => x.GetAll()).Returns(_listMortgages); List <Mortgage> results = _service.GetAllMortgages() as List <Mortgage>; Assert.IsNotNull(results); Assert.AreEqual(2, results.Count); }
public IHttpActionResult Get() { var result = _repository.GetAllMortgages(); if (result == null) { BadRequest(); } return(Ok(result)); }
public IHttpActionResult Get() { var mortgageList = mortgageService.GetAllMortgages(); if (mortgageList == null) { var resp = new HttpResponseMessage(System.Net.HttpStatusCode.NotFound) { Content = new StringContent("Error in retrieving the mortgage list. Please try again"), ReasonPhrase = "Error in retrieving the mortgage list. Please try again" }; throw new HttpResponseException(resp); } return(Ok(mortgageList)); }
public IHttpActionResult Get() { try { var mortgagesLists = _mortgageService.GetAllMortgages(); if (mortgagesLists != null) { return(Ok(mortgagesLists)); } else { return(NotFound()); } } catch (Exception e) { return(InternalServerError(e)); } }
public IEnumerable <Mortgage> Get() { return(_mortgageService.GetAllMortgages()); }
// GET: Mortgage public ActionResult Index() { return(View(_mortgageService.GetAllMortgages())); }