public void DeleteMethodOK() { clsVendorCollection AllVendors = new clsVendorCollection(); clsVendors TestItem = new clsVendors(); Int32 PrimaryKey = 0; TestItem.OpenToBookings = true; TestItem.VendorNo = 1; TestItem.VendorName = "Pizza place"; TestItem.HouseNo = "12a"; TestItem.Street = "street name"; TestItem.City = "city name"; TestItem.Country = "Country name"; TestItem.PostCode = "PO5 7CO"; TestItem.DateAdded = DateTime.Now.Date; TestItem.VendorType = "Food"; TestItem.Summary = "The best pizza place."; //set ThisVendor to the test data AllVendors.ThisVendor = TestItem; PrimaryKey = AllVendors.Add(); TestItem.VendorNo = PrimaryKey; //find the record AllVendors.ThisVendor.Find(PrimaryKey); //delete record AllVendors.Delete(); //now find record Boolean Found = AllVendors.ThisVendor.Find(PrimaryKey); Assert.IsFalse(Found); }
protected void btnYes_Click(object sender, EventArgs e) { clsVendorCollection VendorBook = new clsVendorCollection(); VendorBook.ThisVendor.Find(VendorNo); VendorBook.Delete(); Response.Redirect("VendorList.aspx"); }