public void DeleteMethodOK() { //create an instance of the class we want to create clsDepartmentCollection AllDepartments = new clsDepartmentCollection(); //create the item of test data clsDepartment TestDepartment = new clsDepartment(); //var to store the primary key Int32 PrimaryKey = 20; //set its properties TestDepartment.Dep_Name = "Store"; TestDepartment.Dep_Location = "Liverpool"; TestDepartment.No_Employees = 44; //set ThisAddress to the test data AllDepartments.ThisDepartment = TestDepartment; //add the record PrimaryKey = AllDepartments.Add(); //set the primary key of the test data TestDepartment.Dep_ID = PrimaryKey; //find the record AllDepartments.ThisDepartment.Find(PrimaryKey); //delete the record AllDepartments.Delete(); //now find the record Boolean Found = AllDepartments.ThisDepartment.Find(PrimaryKey); //test to see that the record was not found Assert.IsFalse(Found); }
void DeleteDepartment() { //function to delete the selected record //create a new instance of the address book clsDepartmentCollection departmentBook = new clsDepartmentCollection(); //find the record to delete departmentBook.ThisDepartment.Find(dep_ID); //delete the record departmentBook.Delete(); }