protected void btnYes_Click(object sender, EventArgs e) { clsCostumerCollection CostumerList = new clsCostumerCollection(); CostumerList.ThisCostumer.Find(CostumerID); CostumerList.Delete(); Response.Redirect("CostumerList.aspx"); }
public void DeleteMethodOK() { clsCostumerCollection AllCostumers = new clsCostumerCollection(); clsCostumer TestCostumer = new clsCostumer(); int PrimaryKey = 0; TestCostumer.CostumerID = 1; TestCostumer.Name = "James"; TestCostumer.CostumerAddress = "40 Glenfield Road"; TestCostumer.CostumerDOB = DateTime.Now.Date; TestCostumer.Email = "*****@*****.**"; TestCostumer.Active = true; PrimaryKey = AllCostumers.Add(); TestCostumer.CostumerID = PrimaryKey; AllCostumers.ThisCostumer.Find(PrimaryKey); AllCostumers.Delete(); Boolean Found = AllCostumers.ThisCostumer.Find(PrimaryKey); Assert.IsFalse(Found); }