Example #1
0
        public void StaffFirstNameMax()
        {
            clsStaff AnStaff        = new clsStaff();
            String   Error          = "";
            string   StaffFirstName = "";

            StaffFirstName = StaffFirstName.PadRight(50, 'a');
            Error          = AnStaff.Valid(StaffLastName, StaffFirstName, NINumber, DateStarted, TaxCode, ContactNumber, DateEnded);
            Assert.AreEqual(Error, "");
        }
Example #2
0
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsStaff StaffMember = new clsStaff();
            //string variable to store any error messages
            String Error = "";

            //invoke the method
            Error = StaffMember.Valid(StaffID, StaffName, StaffEmail, StaffDOB, Employer, StaffSalary);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Example #3
0
        public void DateEndedMin()
        {
            clsStaff AnStaff = new clsStaff();
            String   Error   = "";
            DateTime TestDate;

            TestDate = DateTime.Now.Date;
            string DateEnded = TestDate.ToString();

            Error = AnStaff.Valid(StaffLastName, StaffFirstName, NINumber, DateStarted, TaxCode, ContactNumber, DateEnded);
            Assert.AreEqual(Error, "");
        }
Example #4
0
        public void StaffDOBInvalidData()
        {
            //create an instance of the class we want to create
            clsStaff StaffMember = new clsStaff();
            //string variable to store any error messages
            String Error = "";
            //set the Staff DOB to a non date value
            string StaffDOB = "random date!";

            //invoke the method
            Error = StaffMember.Valid(StaffID, StaffName, StaffEmail, StaffDOB, Employer, StaffSalary);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Example #5
0
        public void StaffNameExtreme()
        {
            //create an instance of the class we want to create
            clsStaff StaffMember = new clsStaff();
            //string variable to store any error message
            String Error = "";

            //this should fail
            StaffName = StaffName.PadRight(500, 's');
            //invoke the method
            Error = StaffMember.Valid(StaffID, StaffName, StaffEmail, StaffDOB, Employer, StaffSalary);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Example #6
0
        public void StaffNameMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsStaff StaffMember = new clsStaff();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string StaffName = "jaaaaaaaaaaaaaaaaaaaaaaaaaaaayy"; //this should fail

            //invoke the method
            Error = StaffMember.Valid(StaffID, StaffName, StaffEmail, StaffDOB, Employer, StaffSalary);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Example #7
0
        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, "");
        }
Example #8
0
        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, "");
        }