コード例 #1
0
        public void DeleteMethod()
        {
            //create an instance of a class
            clsFlightCollection AllFlight = new clsFlightCollection();
            //create the item of test data
            clsFlight TestItem = new clsFlight();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.FlightID      = 1;
            TestItem.TicketID      = 2;
            TestItem.DateOfBirth   = "1st May 2000";
            TestItem.Gate          = "12B";
            TestItem.DepartureDate = DateTime.Now.Date;
            //set thisflight to the test data
            AllFlight.ThisFlight = TestItem;
            //add the record
            PrimaryKey = AllFlight.Add();
            //set the primary key of the test data
            TestItem.FlightID = PrimaryKey;
            //find the record
            AllFlight.ThisFlight.Find(PrimaryKey);
            //delete the record
            AllFlight.Delete();
            //now find the record
            Boolean Found = AllFlight.ThisFlight.Find(PrimaryKey);

            //test to see that record was not found
            Assert.IsFalse(Found);
        }
コード例 #2
0
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsFlightCollection AllFlights = new clsFlightCollection();
            //create the item of test data
            clsFlights TestItem = new clsFlights();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.FlightNo         = "AA11";
            TestItem.Airline          = "Air India";
            TestItem.ArrivalAirport   = "DXB";
            TestItem.Arrival          = DateTime.Now.Date;
            TestItem.Departure        = DateTime.Now.Date;
            TestItem.DepartureAirport = "MCR";
            TestItem.Destination      = "Dubai";
            //set ThisFlights to the test data
            AllFlights.ThisFlight = TestItem;
            //add the record
            PrimaryKey = AllFlights.Add();
            //set the primary key of the test data
            TestItem.FlightID = PrimaryKey;
            //find the record
            AllFlights.ThisFlight.Find(PrimaryKey);
            //delete the record
            AllFlights.Delete();
            //now find the record
            Boolean Found = AllFlights.ThisFlight.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
コード例 #3
0
    void DeleteFlight()
    {
        //function to delete the selected record

        //create a new instance of the Booking book
        clsFlightCollection FlightBook = new clsFlightCollection();

        //find the record to delete
        FlightBook.ThisFlight.Find(FlightID);
        //delete the record
        FlightBook.Delete();
    }