Esempio n. 1
0
        //used to test the presence of the Valid Method
        public void Valid()
        {
            //create an instance of the class
            clsEmployee AnEmployee = new clsEmployee();

            //test to see if the valid method exists
            AnEmployee.Valid("Mark");
        }
Esempio n. 2
0
        public void ValidMethodOK()
        {
            //creating an instance of the class we want to create
            clsEmployee AnEmployee = new clsEmployee();
            //string varible  to store any error message
            string Error = "";

            //invoking the valid method
            Error = AnEmployee.Valid(EmployeeFirstName, EmployeeSurName, EmployeeContactNo, EmployeeEmail);
        }
Esempio n. 3
0
        public void EmployeeEmailMinMinusOne()
        {
            clsEmployee AnEmployee    = new clsEmployee();
            String      Error         = "";
            String      EmployeeEmail = "";

            //invoking the method
            Error = AnEmployee.Valid(EmployeeFirstName, EmployeeSurName, EmployeeContactNo, EmployeeEmail);
            //TEST TO SEE THAT THE RESULTS ARE CORRECT
            Assert.AreEqual(Error, "");
        }
Esempio n. 4
0
        //test that the Employee validation throws an error when first name is blank
        public void FisrtNameMinLessOne()
        {
            //create an instance of the class
            clsEmployee AFirstName = new clsEmployee();
            //create a variable to record the result of the validation test
            Boolean OK;

            //test the valid method with a blank string
            OK = AFirstName.Valid("");
            //assert that the outcome should be false
            Assert.IsFalse(OK);
        }
Esempio n. 5
0
        public void EmployeeEmailNoMinPlusOne()
        {
            clsEmployee AnEmployee = new clsEmployee();
            String      Error      = "";
            //creating some test data
            String EmployeeEmail = "Ea";

            //invoking the method
            Error = AnEmployee.Valid(EmployeeFirstName, EmployeeSurName, EmployeeContactNo, EmployeeEmail);
            //checking to see that the results are correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 6
0
        public void EmployeeFirstNameMid()
        {
            clsEmployee AnEmployee = new clsEmployee();
            String      Error      = "";
            //creating some test data
            String EmployeeFirstName = "NnnnnnnnnnNnnnnnnnnnNnnnn"; //25 chars here as max is 50

            //invoking the method
            Error = AnEmployee.Valid(EmployeeFirstName, EmployeeSurName, EmployeeContactNo, EmployeeEmail);
            //checking to see that the results are correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 7
0
        public void EmployeeEmailMaxExstream()
        {
            clsEmployee AnEmployee = new clsEmployee();
            String      Error      = "";
            //creating some test data
            String EmployeeContactNo = "";                    //this is blank a sthe following line of code will fill it

            EmployeeEmail = EmployeeEmail.PadRight(500, 'E'); //essential its saying give it 500chars. This should fail
            //invoking the method
            Error = AnEmployee.Valid(EmployeeFirstName, EmployeeSurName, EmployeeContactNo, EmployeeEmail);
            //checking to see that the results are correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 8
0
        public void EmployeeEmailMaxLessOne()
        {
            clsEmployee AnEmployee = new clsEmployee();
            String      Error      = "";
            //creating some test data
            String EmployeeEmail = ""; //empty a sthe next line will fill it with 49chars

            EmployeeEmail = EmployeeEmail.PadRight(49, 'E');
            //invoking the method
            Error = AnEmployee.Valid(EmployeeFirstName, EmployeeSurName, EmployeeContactNo, EmployeeEmail);
            //checking to see that the results are correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 9
0
        public void PhoneNumberMinPlusOne()
        {
            //create an instance of the class we want to create
            clsEmployee AnEmployee = new clsEmployee();
            //boolean variable to store the result of the validation
            string Error = "";

            //create some test data to assign the property
            PhoneNumber = "aa";
            //invoke the method
            Error = AnEmployee.Valid(FirstName, LastName, Address, PostCode, DateJoined, EmailAddress, PhoneNumber, Jobtitle);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 10
0
        public void LastNameBoundary()
        {
            //create an instance of the class
            clsEmployee ALastName = new clsEmployee();
            //create a variable to record the result of the validation test
            Boolean OK = false;
            //create some test data to asight to the property
            string SomeLastName = "";

            //invoke the method
            OK = ALastName.Valid(SomeLastName);
            // test to see that the result is correct
            Assert.IsFalse(OK);
        }
Esempio n. 11
0
        public void FirstNamePlusOne()
        {
            //create an instance of the class
            clsEmployee AFirstName = new clsEmployee();
            //create a variable to record the result of the validation test
            Boolean OK;
            //create a variable to store the test data
            string SomeText = "gfherhyrhydfhdfyfrghsdtseryscfhdhjugftjgfju";

            //pad the data to the required number of characters
            SomeText = SomeText.PadLeft(21);
            //test the valid method with a two character string
            OK = AFirstName.Valid(SomeText);
            //assert that the outcome should be true
            Assert.IsFalse(OK);
        }
Esempio n. 12
0
        public void PhoneNumberExtremeMax()
        {
            //create an instance of the class we want to create
            clsEmployee AnEmployee = new clsEmployee();
            //boolean variable to store the result of the validation
            string Error = "";

            //create some test data to assign the property
            PhoneNumber = "";
            //pad the string with a charcaters
            PhoneNumber = Address.PadRight(500, 'k');
            //invoke the method
            Error = AnEmployee.Valid(FirstName, LastName, Address, PostCode, DateJoined, EmailAddress, PhoneNumber, Jobtitle);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
        public void ContactNumberExtremeMin()
        {
            //create a new instance of the class we want to create
            clsEmployee AnEmployee = new clsEmployee();
            //string variable to store result of validation
            string OK = "";
            //create some test data to assign to property
            string EmployeeAddress       = "dddd";
            string EmployeeContactNumber = "";
            string EmployeeDOB           = DateTime.Now.Date.ToString();
            string EmployeeEmail         = "*****@*****.**";
            string EmployeeJoinDate      = DateTime.Now.Date.ToString();
            string EmployeeName          = "Vinay";
            string EmployeeRole          = "Accountant";
            string EmployeeSalary        = "1800";

            //invoke method
            OK = AnEmployee.Valid(EmployeeAddress, EmployeeContactNumber, EmployeeDOB, EmployeeEmail, EmployeeJoinDate, EmployeeName, EmployeeRole, EmployeeSalary);
            //test to see if it exists
            Assert.AreNotEqual(OK, "");
        }