protected void BtnOK_Click(object sender, EventArgs e) { ClsPositionCollection positionCollection = new ClsPositionCollection(); positionCollection.ThisPosition.Find(positionID); positionCollection.Delete(); Response.Redirect("PositionList.aspx"); }
public void DeleteMethodOK() { ClsPositionCollection allPosition = new ClsPositionCollection(); ClsPosition testItem = new ClsPosition(); int primaryKey = 0; testItem.PositionID = 1; testItem.PositionName = "Software Engineer"; testItem.Description = "Develop and deploy software."; testItem.Salary = 35000.00M; allPosition.ThisPosition = testItem; primaryKey = allPosition.Add(); testItem.PositionID = primaryKey; allPosition.ThisPosition.Find(primaryKey); allPosition.Delete(); bool found = allPosition.ThisPosition.Find(primaryKey); Assert.IsFalse(found); }