public void Test_Delete_DeletesCityAssociationsFromDatabase() { //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(); departCity.AddFlyingFromFlight(testFlight,arrivalCity); departCity.Delete(); List<Flight> allflights= Flight.GetAll(); List<Flight> testList= new List<Flight>{testFlight2}; //Assert Assert.Equal(testList, allflights); }
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_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); }