コード例 #1
0
        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.");
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public IHttpActionResult Get()
        {
            var result = _repository.GetAllMortgages();

            if (result == null)
            {
                BadRequest();
            }
            return(Ok(result));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
 public IHttpActionResult Get()
 {
     try
     {
         var mortgagesLists = _mortgageService.GetAllMortgages();
         if (mortgagesLists != null)
         {
             return(Ok(mortgagesLists));
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
コード例 #6
0
 public IEnumerable <Mortgage> Get()
 {
     return(_mortgageService.GetAllMortgages());
 }
コード例 #7
0
 // GET: Mortgage
 public ActionResult Index()
 {
     return(View(_mortgageService.GetAllMortgages()));
 }