public void DeleteMethodOK() { //create an instance of the class clsMenuItemCollection AllMenuItems = new clsMenuItemCollection(); // create some test data to assign to the property clsMenuItem TestItem = new clsMenuItem(); // var to store the primary key Int32 PrimaryKey = 0; // set the properties of the test object TestItem.MenuItemNo = 1; TestItem.MenuItem = "Grapes"; TestItem.MenuItemPrice = 4; // set this menu item to the test data AllMenuItems.ThisMenuItem = TestItem; // add the record PrimaryKey = AllMenuItems.Add(); // set the primary key of the test data TestItem.MenuItemNo = PrimaryKey; // find the record AllMenuItems.ThisMenuItem.Find(PrimaryKey); // delete the record AllMenuItems.Delete(); // now find the record Boolean Found = AllMenuItems.ThisMenuItem.Find(PrimaryKey); // test to see that the two values are the same Assert.IsFalse(Found); }
//function to delete the selected record void Delete() { // create a new instance of the menu book clsMenuItemCollection MenuItemBook = new clsMenuItemCollection(); // find the record to delete MenuItemBook.ThisMenuItem.Find(MenuItemNo); // delete the record MenuItemBook.Delete(); }