public void StaffDOBMin() { //create an instance of the class we want to create clsStaff StaffMember = new clsStaff(); //string variable to store any error message String Error = ""; //create a variable to store the test date data DateTime TestDOB; //set staff dob TestDOB = DateTime.Parse("23/03/1999"); //convert the date variable to a string variable string StaffDOB = TestDOB.ToString(); //invoke the method Error = StaffMember.Valid(StaffID, StaffName, StaffEmail, StaffDOB, Employer, StaffSalary); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void ThisStaffMemberOK() { //create an instance of the class we want to create clsStaffCollection AllStaff = new clsStaffCollection(); //create some tesst data to assign to staff clsStaff TestStaffMember = new clsStaff(); //set the properties of test object TestStaffMember.Employer = true; TestStaffMember.StaffDOB = DateTime.Parse("23/03/1999"); TestStaffMember.StaffEmailAddress = "*****@*****.**"; TestStaffMember.StaffID = 1; TestStaffMember.StaffSalary = 30000; TestStaffMember.StaffName = "Name"; //assign the data to the property AllStaff.ThisStaff = TestStaffMember; //test to see that the two values are the same Assert.AreEqual(AllStaff.ThisStaff, TestStaffMember); }
public void StaffDOBExtremeMin() { //create an instance of the class we want to create clsStaff StaffMember = new clsStaff(); //string variable to store any error message String Error = ""; //create a variable to store the test date data DateTime TestDOB; //set the date TestDOB = DateTime.Now.Date; //change the date to whatever the date is less 100 years TestDOB = TestDOB.AddYears(-100); //convert the date variable to a string variable string StaffDOB = TestDOB.ToString(); //invoke the method Error = StaffMember.Valid(StaffID, StaffName, StaffEmail, StaffDOB, Employer, StaffSalary); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void TestStaffSalaryFound() { //create an instance of the class we want to create clsStaff StaffMember = new clsStaff(); //boolean variable to store the result of the search Boolean Found = false; //boolean variable to record if the data is OK(Assume it is) Boolean OK = true; //create some test data to use with the method Int32 StaffID = 1; //invoke the method Found = StaffMember.Find(StaffID); //check the property if (StaffMember.StaffSalary != 50000) { OK = false; } //test to see that the result is correct Assert.IsTrue(OK); }
public void updateMethodOK() { //create an instance of the class we want to crete clsStaffCollection AllStaff = new clsStaffCollection(); //create item of test data clsStaff TestItem = new clsStaff(); //var to store the primary key Int32 PrimaryKey = 0; //set properties TestItem.Employer = true; TestItem.StaffID = 1; TestItem.StaffName = "Name"; TestItem.StaffSalary = 30000; TestItem.StaffEmailAddress = "*****@*****.**"; TestItem.StaffDOB = DateTime.Parse("23/03/1999"); //set ThisStaff to data AllStaff.ThisStaff = TestItem; //add the record PrimaryKey = AllStaff.Add(); //set the primary key to the test data TestItem.StaffID = PrimaryKey; //modify test data TestItem.Employer = false; TestItem.StaffID = 9; TestItem.StaffName = "JayName"; TestItem.StaffSalary = 50000; TestItem.StaffEmailAddress = "*****@*****.**"; TestItem.StaffDOB = DateTime.Parse("22/08/2001"); //set the record based on the new test data AllStaff.ThisStaff = TestItem; //update the record AllStaff.Update(); //find the record AllStaff.ThisStaff.Find(PrimaryKey); //test to see ThisStaff matches the test data Assert.AreEqual(AllStaff.ThisStaff, TestItem); }
public void InstanceOK() { clsStaff StaffManagement = new clsStaff(); Assert.IsNotNull(AnStaff); }
public void InstanceOK() { clsStaff Staff = new clsStaff(); Assert.IsNotNull(Staff); }