public void DeleteMethodOK() { //create an instance of the class clsProductsCollection AllProducts = new clsProductsCollection(); //create the item of test data clsProducts TestItem = new clsProducts(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.ProductID = 1; TestItem.ProductName = "Pokemon"; TestItem.Price = 15.00; TestItem.Quantity = 14; //set ThisProduct to test data AllProducts.ThisProduct = TestItem; //add the record PrimaryKey = AllProducts.Add(); //set the primary key of the test data TestItem.ProductID = PrimaryKey; //find the record AllProducts.ThisProduct.Find(PrimaryKey); //delete the record AllProducts.Delete(); //noe find the record Boolean Found = AllProducts.ThisProduct.Find(PrimaryKey); //test to see that the value was not found Assert.IsFalse(Found); }
void DeleteProduct() { //create new instance of product book clsProductsCollection ProductBook = new clsProductsCollection(); //find the record to delete ProductBook.ThisProduct.Find(ProductID); //delete the record ProductBook.Delete(); }