public void Get_GivenCorrectId_ShouldReturnsAirport()
        {
            int    airportId   = 1;
            string airportName = "airport1";

            mockRepository.Setup(m => m.Get(airportId)).Returns(
                new Airport {
                AirportId = airportId, Name = airportName, Address = "address1", Country = "country1"
            });
            var airport = airportService.Get(airportId);

            Assert.AreEqual(airportName, airport.Name);
        }
Esempio n. 2
0
 public ActionResult Show(int id)
 {
     try
     {
         AirportDTO       airportDTO = airportService.Get(id);
         AirportViewModel airport    = new AirportViewModel
         {
             Id      = airportDTO.Id,
             Name    = airportDTO.Name,
             Address = airportDTO.Address,
             Country = airportDTO.Country
         };
         return(View(airport));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("Error", ex);
     }
     return(View(id));
 }
Esempio n. 3
0
 public ActionResult <IList <Airport> > Get()
 {
     try
     {
         return(Ok(airportService.Get()));
     }
     catch (Exception ex)
     {
         logger.LogError(1, ex, "Get airports");
         return(BadRequest());
     }
 }
 public virtual AirportDTO Get(int id)
 {
     return(service.Get(id));
 }