コード例 #1
0
        public void TestAddCitiesToFlightAndFindFlight()
        {
            Flight newFlight = new Flight("1", "On time", "6:30 PM");

            newFlight.Save();
            City departure = new City("Atlanta");

            departure.Save();
            City arrival = new City("New York");

            arrival.Save();

            newFlight.AddFlight(departure, arrival);
            List <City> expected = new List <City>();

            expected.Add(departure);
            expected.Add(arrival);
            List <City> actual = newFlight.GetCities();

            Assert.Equal(expected, actual);
        }
コード例 #2
0
        public void Test_GetCities_GatAllCities()
        {
            Flight testFlight = new Flight("complete", "5 am", "seattle", "los angeles");

            testFlight.Save();

            City city1 = new City("LA");

            city1.Save();

            City city2 = new City("SJ");

            city2.Save();

            testFlight.AddCity(city1);
            List <City> savedCities = testFlight.GetCities();
            List <City> testList    = new List <City> {
                city1
            };

            Assert.Equal(savedCities, testList);
        }
コード例 #3
0
        public void Test_AddCity_AddCityToFlight()
        {
            Flight testFlight = new Flight("complete", "5 am", "seattle", "los angeles");

            testFlight.Save();

            City city1 = new City("LA");

            city1.Save();

            City city2 = new City("SJ");

            city2.Save();

            testFlight.AddCity(city1);
            testFlight.AddCity(city2);

            List <City> testList = new List <City> {
                city1, city2
            };
            List <City> result = testFlight.GetCities();

            Assert.Equal(testList, result);
        }