Ejemplo n.º 1
0
        public void EmailMaxPlusOne()
        {
            // Create an instance of the Staff class.
            clsStaff staff = new clsStaff();
            // String to store any error messages.
            String Error = "";
            // Test data to pass through the method.
            string Email = "*****@*****.**";

            // Invoke Valid method.
            Error = staff.Valid(staffID, staffName, dateOfBirth, wage, grantAccess, Email);
            // Test to see if the results are correct.
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 2
0
        public void EmailExtremeMax()
        {
            // Create an instance of the Staff class.
            clsStaff staff = new clsStaff();
            // String to store any error messages.
            String Error = "";
            // Test data to pass through the method.
            string Email = "*****@*****.**";

            // Invoke Valid method.
            Error = staff.Valid(staffID, staffName, dateOfBirth, wage, grantAccess, Email);
            // Test to see if the results are correct.
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 3
0
        public void FindMethodOK()
        {
            //instance of a staff class is created
            clsStaff Record = new clsStaff();
            //Boolean variable to store the results of the validaton
            Boolean Found = false;
            //create some test data to use with the method
            Int32 StaffID = 1;

            //invoke the method
            Found = Record.Find(StaffID);
            //test to see if the result is true
            Assert.IsTrue(Found);
        }
Ejemplo n.º 4
0
        public void FullNameMinPlusOne()
        {
            //instance of a staff class is created
            clsStaff Record = new clsStaff();
            //a string variable to store any error message
            string Error = "";
            //some test data is created to pass to the method
            string tstFullName = "aa"; //this should be okay

            //Invoke the method
            Error = Record.Valid(tstFullName, tstStaffPwd, tstSalary, tstDateOfBirth);
            //Test to see if the result is correct
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 5
0
        public void SalaryMaxExtreme()
        {
            //instance of a staff class is created
            clsStaff Record = new clsStaff();
            //a string variable to store any error message
            string Error = "";
            //create a variable to store the test data
            string tstSalary = "2000.00";  //this should fail

            //Invoke the method
            Error = Record.Valid(tstFullName, tstStaffPwd, tstSalary, tstDateOfBirth);
            //Test to see if the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 6
0
        public void SalaryInvalidValue()
        {
            //instance of a staff class is created
            clsStaff Record = new clsStaff();
            //a string variable to store any error message
            string Error = "";
            //Set tstSalary to a non decimal value
            string tstSalary = "this is not a decimal";

            //Invoke the method
            Error = Record.Valid(tstFullName, tstStaffPwd, tstSalary, tstDateOfBirth);
            //Test to see if the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 7
0
        public void EmailMinPlusOne()
        {
            //create an of the class we want to create
            clsStaff AStaff = new clsStaff();
            //string variable to store any error message
            String Error = "";
            //this should pass
            string Email = "aa";

            //invoke the method
            Error = AStaff.Valid(Name, JobRole, Email, DateStarted);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 8
0
        public void JobRoleMinLessOne()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //string variable to store any error message
            String Error = "";
            //this should fail
            string JobRole = "";

            //invoke the method
            Error = AStaff.Valid(Name, JobRole, Email, DateStarted);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 9
0
        public void DateStartedInvalidData()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //String variable to store error message
            String Error = "";
            //Add detail to string
            string DateStarted = "This is not the date";

            //invoke the method
            Error = AStaff.Valid(Name, JobRole, Email, DateStarted);
            //Test to see if the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 10
0
        public void NameMin()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string Name = "a"; //this should be ok

            //invoke the method
            Error = AStaff.Valid(Name, JobRole, Email, DateStarted);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 11
0
        public void FindMethodOkay()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //Boolean value to store the results of the validation
            Boolean Found = false;
            //Create some test data to use with the method
            Int32 StaffId = 1;

            //Invoke the method
            Found = AStaff.Find(StaffId);
            //test to see if the result is true
            Assert.IsTrue(Found);
        }
Ejemplo n.º 12
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        clsStaff AnStaff        = new clsStaff();
        string   StaffFirstName = txtStaffFirstName.Text;
        string   NINumber       = txtNINumber.Text;
        string   StaffLastName  = txtStaffLastName.Text;
        string   ContactNumber  = txtContactNumber.Text;
        string   DateStarted    = txtDateStarted.Text;
        string   DateEnded      = txtDateEnded.Text;
        string   Salary         = txtSalary.Text;
        string   Taxcode        = txtTaxcode.Text;
        string   Error          = "";

        Error = AnStaff.Valid(StaffLastName, StaffFirstName, NINumber, DateStarted, TaxCode, ContactNumber, DateEnded);
        if (Error == "")
        {
            AnStaff.StaffId        = StaffId;
            AnStaff.StaffFirstName = StaffFirstName;
            AnStaff.StaffLastName  = StaffLastName;
            AnStaff.ContactNumber  = ContactNumber;
            AnStaff.NINumber       = NINumber;
            AnStaff.Salary         = Salary;
            AnStaff.Taxcode        = TaxCode;
            AnStaff.DateStarted    = Convert.ToDateTime(DateStarted);
            AnStaff.DateEnded      = Convert.ToDateTime(DateEnded);
            Session["AnStaff"]     = AnStaff;
            Response.Write("StaffViewer.aspx");
            clsStaffCollection StaffList = new clsStaffCollection();

            if (StaffId == -1)

            {
                StaffList.ThisStaff = anStaff;
                StaffList.Add();
            }
            else
            {
                StaffList.ThisStaff.Find(StaffId);
                StaffList.ThisStaff = anStaff;
                StaffList.Update();
            }

            Response.Redirect("StaffViewer.aspx");
        }
        else
        {
            lblError.Text = Error;
        }
    }
Ejemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Create a new instance
        clsStaff AStaff = new clsStaff();

        // Get the data from the session object
        AStaff = (clsStaff)Session["AStaff"];
        // Display the name for this entry
        Response.Write(AStaff.StaffId + " ");
        Response.Write(AStaff.FullName + " ");
        Response.Write(AStaff.PhoneNumber + " ");
        Response.Write(AStaff.HourlyWage + " ");
        Response.Write(AStaff.DateOfBirth + " ");
        Response.Write(AStaff.IsWorking + " ");
    }
Ejemplo n.º 14
0
        public void StaffIDMaxlessOne()
        {
            //create an instance of the class we want to create
            clsStaff AnStaff = new clsStaff();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            //this should pass
            string StaffID = "aaaa"; //this should be ok

            //invoke the method
            Error = AnStaff.Valid(StaffPosition, StaffID, FirstName, StartDate, DateOfBirth);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 15
0
        public void FirstNameExtremeMax()
        {
            //create an instance of the class we want to create
            clsStaff AnStaff = new clsStaff();
            //String variable to store an error message
            String Error = "";
            //create some test data to pass to the method
            string FirstName = "";

            FirstName = FirstName.PadRight(500, 'a'); //this should fail
            //invoke the method
            Error = AnCustomer.Valid(StaffPosition, StaffID, FirstName, StartDate, DateOfBirth);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 16
0
        public void TestContactNoFoundOK()
        {
            clsStaff Staff   = new clsStaff();
            Boolean  found   = false;
            Boolean  OK      = true;
            Int32    StaffID = 6;

            found = Staff.Find(StaffID);
            if (Staff.ContactNo != "4407")
            {
                OK = false;
            }

            Assert.IsTrue(OK);
        }
Ejemplo n.º 17
0
        public void FindMethodOK()

        {
            //create a instant of the class want to create
            clsStaff AStaff = new clsStaff();
            // boolean variable to store the results of the validation
            Boolean Found = false;
            //create some test data to test the find method
            Int32 StaffID = 2;

            //invoke the method
            Found = AStaff.Find(StaffID);
            // tests to see if the results are true
            Assert.IsTrue(Found);
        }
Ejemplo n.º 18
0
        public void TestLoggedIOFoundOK()
        {
            clsStaff Staff   = new clsStaff();
            Boolean  found   = false;
            Boolean  OK      = true;
            Int32    StaffID = 6;

            found = Staff.Find(StaffID);
            if (Staff.LoggedInOut != true)
            {
                OK = false;
            }

            Assert.IsTrue(OK);
        }
Ejemplo n.º 19
0
        public void TestAddressFoundOK()
        {
            clsStaff Staff   = new clsStaff();
            Boolean  found   = false;
            Boolean  OK      = true;
            Int32    StaffID = 6;

            found = Staff.Find(StaffID);
            if (Staff.Address != "6 Overton Road, Leicester, LE5 2WH")
            {
                OK = false;
            }

            Assert.IsTrue(OK);
        }
Ejemplo n.º 20
0
        public void TestDOBFoundOK()
        {
            clsStaff Staff   = new clsStaff();
            Boolean  found   = false;
            Boolean  OK      = true;
            Int32    StaffID = 6;

            found = Staff.Find(StaffID);
            if (Staff.DateOfBirth != Convert.ToDateTime("31/07/1996"))
            {
                OK = false;
            }

            Assert.IsTrue(OK);
        }
Ejemplo n.º 21
0
        public void HourlyWageMin()
        {
            // Create new instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            // String varaible to store error message
            String Error = " ";
            // create test value
            double TestWage = 4.15;

            HourlyWage = Convert.ToString(TestWage); // this should pass
            //Invoke the method
            Error = AStaff.Valid(StaffId, FullName, DateOfBirth, HourlyWage, PhoneNumber);
            // test to see that the value is correct
            Assert.AreEqual(Error, " ");
        }
Ejemplo n.º 22
0
        public void TestDateOfBirthFound()
        {
            clsStaff AStaff  = new clsStaff();
            Boolean  Found   = false;
            Boolean  OK      = true;
            Int32    staffId = 20;

            Found = AStaff.Find(staffId);
            if (AStaff.dateOfBirth != Convert.ToDateTime("03/05/2021"))

            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
Ejemplo n.º 23
0
        public void StaffTelNumberExtremeMax()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //string varaible to store the results of the validation
            String Error = "";
            //create some test data to pass to the method
            string StaffTelNumber = "";

            StaffTelNumber = StaffTelNumber.PadRight(500, 'a');
            //invoke the method
            Error = AStaff.Valid(StaffName, StaffAddress, StaffTelNumber, DateJoined, StaffID);
            //test to see if the results is true
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 24
0
        public void NameMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //string variable to store any error message
            String Error = "";
            //this should fail
            string Name = ""; //this should be ok

            Name = Name.PadRight(51, 'a');
            //invoke the method
            Error = AStaff.Valid(Name, Surname, DateofBirth, PhoneNumber);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 25
0
        public void SurnameMid()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string Surname = ""; //this should be ok

            Surname = Surname.PadRight(25, 'a');
            //invoke the method
            Error = AStaff.Valid(Name, Surname, DateofBirth, PhoneNumber);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 26
0
        public void StaffPostCodeExtremeMax()
        {
            // create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //string variable to store error message
            String Error = "";
            //some test data to pass the method
            string staffPostCode = "";

            staffPostCode = staffPostCode.PadRight(500, 'a');
            //invoke the method
            Error = AStaff.Valid(FirstName, LastName, StaffAddress, StaffPhoneNo, staffPostCode);
            //Test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 27
0
        public void StaffIDExtremeMax()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //string variable to store any error message
            String Error = "";
            //this should fail
            string StaffID = "";

            StaffID = StaffID.PadRight(500, 'a');
            //invoke the method
            Error = AStaff.Valid(StaffName, StaffAddress, StaffTelNumber, DateJoined, StaffID);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 28
0
        public void FullNameMid()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //String variable to store any error message
            String Error = "";
            //this test should pass
            string FullName = "";

            FullName = FullName.PadRight(25, 'a');
            //invoke the method
            Error = AStaff.Valid(FullName, Salary, DateOfJoining, Position);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 29
0
        public void passwordExtremeMax()
        {
            clsStaff AStaff = new clsStaff();

            String Error = "";

            string password = "";

            password = password.PadRight(500, 'a');


            Error = AStaff.Valid(firstName, surname, dateOfBirth, password);

            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 30
0
        public void PositionExtreme()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //String variable to store any error message
            String Error = "";
            //this test should fail
            string Position = "";

            Position = Position.PadRight(500, 'a');
            //invoke the method
            Error = AStaff.Valid(FullName, Salary, DateOfJoining, Position);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }