public void DeleteMethodOK() { //create an instance of the class we want to creat clsDestinationCollection AllDestinations = new clsDestinationCollection(); //create the item of test data clsDestination TestItem = new clsDestination(); //var to store the primary key Int32 Primarykey = 0; //set its properties TestItem.DestinationID = 1; TestItem.EndPointHouseNo = "1"; TestItem.EndPointPostCode = "LE2 2WX"; TestItem.EndPointStreet = "God Street"; TestItem.EndPointTown = "Leicester"; TestItem.PickupTime = DateTime.Now.Date; TestItem.DropoffTime = DateTime.Now.Date; //set ThisDestination to the test data AllDestinations.ThisDestination = TestItem; //add the record Primarykey = AllDestinations.Add(); //find the record AllDestinations.ThisDestination.Find(Primarykey); //Delete the record AllDestinations.Delete(); //not find the record Boolean Found = AllDestinations.ThisDestination.Find(Primarykey); //test to see that the record was not found Assert.IsFalse(Found); }
void DeleteDestination() { //function to delete the select record //create a new instance of the Destination book clsDestinationCollection DestinationBook = new clsDestinationCollection(); //find the record to delete DestinationBook.ThisDestination.Find(DestinationID); //Delete the record DestinationBook.Delete(); }