Example #1
0
        public void Test_Find()
        {
            Flight newFlight = new Flight("1", "On time", "6:30 PM");

            newFlight.Save();

            Flight result = Flight.Find(newFlight.GetId());

            Assert.Equal(newFlight, result);
        }
Example #2
0
        public void TEST_FindMethodReturnsSameObject()
        {
            Flight tempFlight = new Flight("complete", "5 am", "seattle", "los angeles");

            tempFlight.Save();
            // Console.WriteLine(tempFlight.GetDestinationCity());

            Flight testFlight = Flight.Find(tempFlight.GetId());

            // Console.WriteLine(testFlight.GetDestinationCity());

            Assert.Equal(tempFlight, testFlight);
        }
Example #3
0
        public void Test_Find_ReturnFlightFromDatabase()
        {
            //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
            Flight foundFlight = Flight.Find(testFlight.GetId());

            //Assert
            Assert.Equal(testFlight, foundFlight);
        }
Example #4
0
 public override bool Equals(System.Object otherFlight)
 {
     if (!(otherFlight is Flight))
     {
         return(false);
     }
     else
     {
         Flight newFlight         = (Flight)otherFlight;
         bool   idEquality        = this.GetId() == newFlight.GetId();
         bool   flightNumEquality = this.GetFlightNum() == newFlight.GetFlightNum();
         bool   statusEquality    = this.GetStatus() == newFlight.GetStatus();
         bool   timeEquality      = this.GetTime() == newFlight.GetTime();
         return(idEquality && flightNumEquality && statusEquality && timeEquality);
     }
 }
Example #5
0
        public override bool Equals(System.Object otherFlight)
        {
            if (!(otherFlight is Flight))
            {
                return(false);
            }
            else
            {
                Flight newFlight             = (Flight)otherFlight;
                bool   idEquality            = (this.GetId() == newFlight.GetId());
                bool   flightNumberEquality  = (this.GetFlightNumber() == newFlight.GetFlightNumber());
                bool   departureTimeEquality = (this.GetDepartureTime() == newFlight.GetDepartureTime());
                bool   flightStatusEquality  = (this.GetStatus() == newFlight.GetStatus());

                return(idEquality && flightNumberEquality && departureTimeEquality && flightStatusEquality);
            }
        }
Example #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);
        }