Esempio n. 1
0
        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);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
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);
        }