Example #1
0
        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);
        }
Example #2
0
        public void T8_Delete_DeletesCityFromDatabase()
        {
            //Arrange
              City testCity1 = new City("Seattle","WA","USA");
              City testCity2 = new City("New York","WA","USA");

              testCity1.Save();
              testCity2.Save();

              //Act
              testCity1.Delete();
              List<City> resultCategories = City.GetAll();
              List<City> testCityList = new List<City> {testCity2};

              //Assert
              Assert.Equal(testCityList, resultCategories);
        }