Esempio n. 1
0
        public void TEST_ChecksIfDBIsEmpty()
        {
            //Arrange, Act
            int result = Flight.GetAll().Count;

            Assert.Equal(0, result);
        }
Esempio n. 2
0
        public void Test_DatabaseEmptyAtFirst()
        {
            //Arrange,Act
            int result = Flight.GetAll().Count;

            //Assert
            Assert.Equal(0, result);
        }
Esempio n. 3
0
        public static Dictionary <string, object> ModelMaker()
        {
            Dictionary <string, object> model = new Dictionary <string, object> {
            };

            model.Add("Flights", Flight.GetAll());
            model.Add("Cities", City.GetAll());
            return(model);
        }
Esempio n. 4
0
        public void Test_Save_CheckFlightSaveToDB()
        {
            List <Flight> totalFlights = new List <Flight> {
            };
            Flight tempFlight          = new Flight("complete", "5 am", "seattle", "los angeles");

            totalFlights.Add(tempFlight);

            tempFlight.Save();
            Assert.Equal(totalFlights, Flight.GetAll());
        }
Esempio n. 5
0
        public void Test_Delete()
        {
            Flight newFlight = new Flight("1", "On time", "6:30 PM");

            newFlight.Save();
            List <Flight> expected = new List <Flight> {
            };

            newFlight.Delete();
            List <Flight> actual = Flight.GetAll();

            Assert.Equal(expected, actual);
        }
Esempio n. 6
0
        public void Test_Save_AssignedIdtoFlight()
        {
            //Arrange
            DateTime departureTime = new DateTime(2017, 3, 14, 9, 30, 0);
            string   flightStatus  = "On Time";
            Flight   testFlight    = new Flight("AX5390", departureTime, flightStatus);

            testFlight.Save();
            Flight savedFlight = Flight.GetAll()[0];

            //Act
            int savedId = savedFlight.GetId();
            int testId  = testFlight.GetId();

            //Assert
            Assert.Equal(testId, savedId);
        }
Esempio n. 7
0
        public void Test_Save_SavesToDatabase()
        {
            //Arrange
            DateTime departureTime = new DateTime(2017, 3, 14, 9, 30, 0);
            string   flightStatus  = "On Time";
            Flight   testFlight    = new Flight("AX5390", departureTime, flightStatus);

            testFlight.Save();

            //Act
            List <Flight> resultList = Flight.GetAll();
            List <Flight> testList   = new List <Flight> {
                testFlight
            };

            //Assert
            Assert.Equal(testList, resultList);
        }
Esempio n. 8
0
        public void Test_DeleteThisFlight_OneFlightDeletedFromDatabase()
        {//Arrange
            DateTime departureTime = new DateTime(2017, 3, 14, 9, 30, 0);
            string   flightStatus  = "On Time";
            Flight   firstFlight   = new Flight("AX5390", departureTime, flightStatus);
            Flight   secondFlight  = new Flight("BD890", departureTime, flightStatus);

            firstFlight.Save();
            secondFlight.Save();

            //Act
            firstFlight.DeleteThisFlight();
            List <Flight> result = Flight.GetAll();
            List <Flight> verify = new List <Flight> {
                secondFlight
            };

            //Assert
            Assert.Equal(verify, result);
        }
Esempio n. 9
0
        public void Test_GetAll_ReturnsListofFlights()
        {
            //Arrange
            DateTime firstDepartureTime  = new DateTime(2017, 3, 14, 9, 30, 0);
            DateTime secondDepartureTime = new DateTime(2007, 3, 14, 9, 30, 0);
            string   flightStatus        = "On Time";
            Flight   firstFlight         = new Flight("AX5390", firstDepartureTime, flightStatus);
            Flight   secondFlight        = new Flight("B45390", secondDepartureTime, flightStatus);

            //Act
            firstFlight.Save();
            secondFlight.Save();

            //Assert
            List <Flight> actualResult   = Flight.GetAll();
            List <Flight> expectedResult = new List <Flight> {
                secondFlight, firstFlight
            };

            Assert.Equal(expectedResult, actualResult);
        }
Esempio n. 10
0
        public void Test_IfEmpty()
        {
            int result = Flight.GetAll().Count;

            Assert.Equal(0, result);
        }