public IActionResult AddParkingReservation(AirplaneParkingRequest airplane) { var parkingReservation = new ParkingReservationService(_airplaneRepository, _reservationRepository); var result = parkingReservation.AddParkingReservation(airplane); return(Ok(result)); }
public void WhenTwoJumbosAirplanesAreParked() { var airplaneRepo = new Mock <IAirplaneRepository>(); _reservationRepo = new Mock <IReservationRepository>(); airplaneRepo.Setup(x => x.Get(It.Is <Airplane>(x => x.Model == "B777" && x.Type == "JET"))).Returns(new Airplane { Type = "JET", Size = 50 }); _reservationRepo.Setup(x => x.GetAll()).Returns(new List <Reservation> { new Reservation { PlaneType = "jumbo", Slots = 25 }, new Reservation { PlaneType = "JUMBO", Slots = 25 }, new Reservation { PlaneType = "JUMBO", Slots = 25 }, }); _subject = new ParkingReservationService(airplaneRepo.Object, _reservationRepo.Object); _result = _subject.AddParkingReservation(new AirplaneParkingRequest { Type = "JET", Model = "B777" }); }
public IActionResult GetParkingReservations() { var parkingReservation = new ParkingReservationService(_airplaneRepository, _reservationRepository); var result = parkingReservation.GetAll(); return(Ok(result)); }
public IActionResult Delete(int id) { var parkingReservation = new ParkingReservationService(_airplaneRepository, _reservationRepository); parkingReservation.RemoveParkingReservation(id); return(Ok("Removed parking reservation.")); }
public void WhenFourAirPlanesAreParked() { var reservationRepo = new Mock <IReservationRepository>(); reservationRepo.Setup(x => x.GetAll()).Returns(new List <Reservation> { new Reservation(), new Reservation(), new Reservation(), new Reservation() }); var subject = new ParkingReservationService(null, reservationRepo.Object); _result = subject.GetAll(); }