public void TestCreateFlight() { test = new TestInfo(); Country testCountry = new Country("usa"); testCountry.ID = test.adminF.CreateNewCountry(test.adminT, testCountry); Flight flight = new Flight(test.airlineT.User.ID, testCountry.ID, testCountry.ID, DateTime.ParseExact("2019-07-08 12:00:00", "yyyy-MM-dd HH:mm:ss", null), DateTime.ParseExact("2019-07-18 12:00:00", "yyyy-MM-dd HH:mm:ss", null), 5); FlightDAOMSSQL Fdao = new FlightDAOMSSQL(); flight.ID = Fdao.ADD(flight); Assert.AreEqual(flight.AirLineCompanyID, test.airlineF.GetFlightById(flight.ID).AirLineCompanyID); }
public void TestGetAllflightsAirlineFacade() { test = new TestInfo(); Country testCountry = new Country("usa"); testCountry.ID = test.adminF.CreateNewCountry(test.adminT, testCountry); Flight flight = new Flight(test.airlineT.User.ID, testCountry.ID, testCountry.ID, DateTime.ParseExact("2019-07-08 12:00:00", "yyyy-MM-dd HH:mm:ss", null), DateTime.ParseExact("2019-07-18 12:00:00", "yyyy-MM-dd HH:mm:ss", null), 5); FlightDAOMSSQL Fdao = new FlightDAOMSSQL(); flight.ID = Fdao.ADD(flight); IList <Flight> flights = test.airlineF.GetAllFlights(); Assert.AreEqual(flights.Count, 1); }
public void TestCancelTicket() { test = new TestInfo(); Country testCountry = new Country("usa"); testCountry.ID = test.adminF.CreateNewCountry(test.adminT, testCountry); Flight flight = new Flight(test.airlineT.User.ID, testCountry.ID, testCountry.ID, DateTime.ParseExact("2019-07-08 12:00:00", "yyyy-MM-dd HH:mm:ss", null), DateTime.ParseExact("2019-07-18 12:00:00", "yyyy-MM-dd HH:mm:ss", null), 5); FlightDAOMSSQL Fdao = new FlightDAOMSSQL(); flight.ID = Fdao.ADD(flight); Ticket t = test.customerF.PurchaseTicket(test.customerT, flight); TicketDAOMSSQL tDAO = new TicketDAOMSSQL(); test.customerF.CancelTicket(test.customerT, t); Assert.AreEqual(0, tDAO.Get(t.ID).ID); }
public void TestNoMoreTicketsException() { test = new TestInfo(); Country testCountry = new Country("usa"); Country testCountry2 = new Country("russia"); testCountry.ID = test.adminF.CreateNewCountry(test.adminT, testCountry); testCountry2.ID = test.adminF.CreateNewCountry(test.adminT, testCountry2); AirLineCompany a = new AirLineCompany("amrican", "amrican", "12345", testCountry.ID); a.ID = test.adminF.CreateNewAirline(test.adminT, a); Flight flight = new Flight(a.ID, testCountry.ID, testCountry2.ID, DateTime.ParseExact("2019-07-08 12:00:00", "yyyy-MM-dd HH:mm:ss", null), DateTime.ParseExact("2019-07-18 12:00:00", "yyyy-MM-dd HH:mm:ss", null), 0); FlightDAOMSSQL Fdao = new FlightDAOMSSQL(); flight.ID = Fdao.ADD(flight); test.customerF.PurchaseTicket(test.customerT, flight); }