Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }