Esempio n. 1
0
        public void DeleteMethod()
        {
            //create an instance of a class
            clsLocationCollection AllLocation = new clsLocationCollection();
            //create the item of test data
            clsLocation TestItem = new clsLocation();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.LocationID         = 1;
            TestItem.PlaneID            = 2;
            TestItem.CountryDeparture   = "Bulgaria";
            TestItem.CountryDestination = "Africa";
            TestItem.AirportDeparture   = "Heathrow";
            TestItem.AirportDestination = "Gatwick";
            //set this location to the test data
            AllLocation.ThisLocation = TestItem;
            //add the record
            PrimaryKey = AllLocation.Add();
            //set the primary key of the test data
            TestItem.LocationID = PrimaryKey;
            //find the record
            AllLocation.ThisLocation.Find(PrimaryKey);
            //delete the record
            AllLocation.Delete();
            //now find the record
            Boolean Found = AllLocation.ThisLocation.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
Esempio n. 2
0
    void DeleteLocation()
    {
        //function to delete the selected record

        //create a new instance of the Booking book
        clsLocationCollection LocationBook = new clsLocationCollection();

        //find the record to delete
        LocationBook.ThisLocation.Find(LocationID);
        //delete the record
        LocationBook.Delete();
    }