public void DeleteMethodOK() { //Create an instance of the collections class StaffingCollection aStaffCollection = new StaffingCollection(); //create an instance of test data Staffing TestItem = new Staffing(); //Primary key storage Int32 primaryKey = 0; //Initiate properties of test data TestItem.staffName = new Name("Thomas", "Barnes"); TestItem.staffNumber = "01706844505"; TestItem.staffEmail = "*****@*****.**"; TestItem.staffDOB = Convert.ToDateTime("08/09/1990"); TestItem.staffValid = true; //Set test data into collections aStaffCollection.ThisStaff = TestItem; //Add the record primaryKey = aStaffCollection.Add(); //Set the primary key of the test data TestItem.staffID = primaryKey; //Find the record aStaffCollection.ThisStaff.Find(primaryKey); //delete the record aStaffCollection.Delete(); //Find the deleted record Boolean Found = aStaffCollection.ThisStaff.Find(primaryKey); //Test to see that the two values are the same Assert.IsFalse(Found); }
protected void btnY_Click(object sender, EventArgs e) { StaffingCollection aStaffingCollection = new StaffingCollection(); aStaffingCollection.ThisStaff.Find(StaffID); aStaffingCollection.Delete(); Response.Redirect("Staffing_List.aspx"); }