public void ListAndCountOK() { clsStaffCollection allStaff = new clsStaffCollection(); List <clsStaff> tstList = new List <clsStaff>(); clsStaff tstStaff = new clsStaffFactory().MakeNewStaffObj(); tstList.Add(tstStaff); allStaff.StaffList = tstList; Assert.AreEqual(allStaff.Count, tstList.Count); }
public void TestLastNameSpaceStringValid() { // Generate a new staff object with the factory clsStaff staff = new clsStaffFactory().MakeNewStaffObj(); // Should already be a valid object // Hold an empty string to simulate error string string error = ""; staff.last_name = " "; // Call the test method error = staff.Valid(staff.salary, staff.first_name, staff.last_name, staff.active); Assert.AreNotEqual("", error); }
public void TestValidSalaryNegative() { // Generate a new staff object with the factory clsStaff staff = new clsStaffFactory().MakeNewStaffObj(); // Hold an empty string to simulate error string string error = ""; // Set salary on object staff.salary = -100; // Call the test method error = staff.Valid(staff.salary, staff.first_name, staff.last_name, staff.active); Assert.AreNotEqual("", error); }
public void AddMethodOK() { clsStaffCollection allStaff = new clsStaffCollection(); clsStaff test = new clsStaffFactory().MakeNewStaffObj(); Int32 primaryKey = 0; allStaff.thisStaff = test; primaryKey = allStaff.Add(); test.EmployeeNo = primaryKey; allStaff.thisStaff.find(primaryKey); Assert.AreEqual(allStaff.thisStaff, test); }
public void TestValidPass() { // Generate a new staff object with the factory clsStaff staff = new clsStaffFactory().MakeNewStaffObj(); // Should already be a valid object // Hold an empty string to simulate error string string error = ""; // Call the test method error = staff.Valid(staff.salary, staff.first_name, staff.last_name, staff.active); if (error != "") { Console.WriteLine("Test failed with " + error); } Assert.AreEqual("", error); }