public void DeleteMethodOK() { clsShippingCollection AllShipments = new clsShippingCollection(); //create item of test data clsShipping TestShipment = new clsShipping(); //store primary key Int32 PrimaryKey = 0; //set its properties TestShipment.ShippingType = "Standard"; TestShipment.Price = 4.99m; TestShipment.DateOfDispatch = DateTime.Now.Date; TestShipment.Dispatched = true; //set ThisItem to test data AllShipments.ThisShipment = TestShipment; //add record PrimaryKey = AllShipments.Add(); //set primary key of test data TestShipment.ShippingId = PrimaryKey; //find record AllShipments.ThisShipment.Find(PrimaryKey); //delete record AllShipments.Delete(); //find record now Boolean Found = AllShipments.ThisShipment.Find(PrimaryKey); //test to see record was not found Assert.IsFalse(Found); }
protected void btnYes_Click(object sender, EventArgs e) { //create new instance of clsStockCollection clsShippingCollection AllShipments = new clsShippingCollection(); //find record to delete AllShipments.ThisShipment.Find(ShippingId); //delete record AllShipments.Delete(); //redirect to main page Response.Redirect("ShippingList.aspx"); }