public void Test_GetFlightsbyDeparting_ReturnAllCityFlights() { City departCity = new City("Seattle","WA","USA"); City arrivalCity = new City("New York","WA","USA"); departCity.Save(); arrivalCity.Save(); DateTime departing_time= new DateTime(2016,06,05); DateTime returning_time = new DateTime(2016, 1, 1); Flight testFlight = new Flight("E201","On time",departing_time,returning_time); testFlight.Save(); Flight testFlight2 = new Flight("E202","Late",departing_time,returning_time); testFlight2.Save(); departCity.AddFlyingFromFlight(testFlight,arrivalCity); List<Flight> savedFlights = departCity.GetFlightsbyDeparting(); List<Flight> testList= new List<Flight>{testFlight}; Assert.Equal(testList,savedFlights); }
public void Test_Delete_DeletesFlightAssociationsFromDatabase() { //Arrange DateTime departing_time= new DateTime(2016,06,05); DateTime returning_time = new DateTime(2016, 1, 1); Flight testFlight = new Flight("E201","On time",departing_time,returning_time); testFlight.Save(); City departCity = new City("Seattle","WA","USA"); City arrivalCity = new City("New York","WA","USA"); departCity.Save(); arrivalCity.Save(); //Act testFlight.AddCity(departCity,arrivalCity); testFlight.Delete(); List<Flight> resultCityFlights = departCity.GetFlightsbyDeparting(); List<Flight> testCityFlights = new List<Flight> {}; //Assert Assert.Equal(testCityFlights, resultCityFlights); }
public void Test_AddFlyingFromFlight_AddsFlightToCity() { //Arrange City departCity = new City("Seattle","WA","USA"); City arrivalCity = new City("New York","WA","USA"); departCity.Save(); arrivalCity.Save(); DateTime departing_time= new DateTime(2016,06,05); DateTime returning_time = new DateTime(2016, 1, 1); Flight testFlight = new Flight("E201","On time",departing_time,returning_time); testFlight.Save(); Flight testFlight2 = new Flight("E202","Late",departing_time,returning_time); testFlight2.Save(); //Act departCity.AddFlyingFromFlight(testFlight,arrivalCity); departCity.AddFlyingFromFlight(testFlight2,arrivalCity); List<Flight> result = departCity.GetFlightsbyDeparting(); List<Flight> testList = new List<Flight> {testFlight, testFlight2}; Assert.Equal(testList, result); }