コード例 #1
0
ファイル: tstStaffing.cs プロジェクト: xIMzEr/DeMon_Tutoring
        public void ValidMethodOK()
        {
            //create an instance of staff
            Staffing aStaff = new Staffing();
            //string variable to store any error message
            String Error = "";

            //invoke the method
            //We ignore staffValid as it only can contain a boolean value
            Error = aStaff.Valid(staffFN, staffLN, staffEmail, staffNumber, staffDOB);
            //Test to see if the result is correct
            Assert.AreEqual(Error, "");
        }
コード例 #2
0
ファイル: tstStaffing.cs プロジェクト: xIMzEr/DeMon_Tutoring
        public void StaffEmailMid()
        {
            //Create an instance of staffing
            Staffing aStaff = new Staffing();
            //string variable to store any error message
            String Error = "";
            //Test data to pass the method
            string Email = "*****@*****.**";

            //Invoke the method
            Error = aStaff.Valid(staffFN, staffLN, Email, staffNumber, staffDOB);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
コード例 #3
0
ファイル: tstStaffing.cs プロジェクト: xIMzEr/DeMon_Tutoring
        public void StaffNumberMaxPlusOne()
        {
            //Create an instance of staffing
            Staffing aStaff = new Staffing();
            //string variable to store any error message
            String Error = "";
            //Test data to pass the method
            string Number = "013865391025";

            //Invoke the method
            Error = aStaff.Valid(staffFN, staffLN, staffEmail, Number, staffDOB);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
コード例 #4
0
ファイル: tstStaffing.cs プロジェクト: xIMzEr/DeMon_Tutoring
        public void StaffLastNameMaxMinusOne()
        {
            //Create an instance of staffing
            Staffing aStaff = new Staffing();
            //string variable to store any error message
            String Error = "";
            //Test data to pass the method
            string LastName = "Aaaaaaaaaaaaaa";

            //Invoke the method
            Error = aStaff.Valid(staffFN, LastName, staffEmail, staffNumber, staffDOB);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
コード例 #5
0
ファイル: tstStaffing.cs プロジェクト: xIMzEr/DeMon_Tutoring
        public void DOBInvalidData()
        {
            //Create an instance of staffing
            Staffing aStaff = new Staffing();
            //string variable to store any error message
            String Error = "";
            //set StaffDOB to a non date data type
            string staffDOBTest = "this is not a date";

            //Invoke the method
            Error = aStaff.Valid(staffFN, staffLN, staffEmail, staffNumber, staffDOBTest);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
コード例 #6
0
ファイル: tstStaffing.cs プロジェクト: xIMzEr/DeMon_Tutoring
        public void StaffFirstNameMinLessOne()
        {
            //Create an instance of staffing
            Staffing aStaff = new Staffing();
            //string variable to store any error message
            String Error = "";
            //Test data to fail the method
            string FirstName = "";

            //Invoke the method
            Error = aStaff.Valid(FirstName, staffLN, staffEmail, staffNumber, staffDOB);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
コード例 #7
0
ファイル: tstStaffing.cs プロジェクト: xIMzEr/DeMon_Tutoring
        public void StaffEmailExtremeMax()
        {
            //Create an instance of staffing
            Staffing aStaff = new Staffing();
            //string variable to store any error message
            String Error = "";
            //Test data to pass the method
            string Email = "*****@*****.**";

            Email = Email.PadRight(470, 'a');
            //Invoke the method
            Error = aStaff.Valid(staffFN, staffLN, Email, staffNumber, staffDOB);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
コード例 #8
0
    protected void OkButton_Click(object sender, EventArgs e)
    {
        //Create a new instance of staff
        Staffing staff = new Staffing();
        //String to store any error messages
        String Error = "";

        //Validate the data
        Error = staff.Valid(txtFirstName.Text, txtLastName.Text, txtEmail.Text, txtNumber.Text, txtDOB.Text);
        if (Error == "")
        {
            //capture the staff ID
            staff.staffID = StaffID;
            //Capture the Staff name
            staff.staffName = new Name(txtFirstName.Text, txtLastName.Text);
            //Capture the email
            staff.staffEmail = txtEmail.Text;
            //Capture the staff
            staff.staffNumber = txtNumber.Text;
            //Capture the staff DOB
            staff.staffDOB = Convert.ToDateTime(txtDOB.Text);
            //Capture the staff Validity
            staff.staffValid = StaffValid.Checked;
            //Create a new instance of the staffing collection
            StaffingCollection staffList = new StaffingCollection();

            if (StaffID == -1)
            {
                staffList.ThisStaff = staff;
                staffList.Add();
            }
            else
            {
                staffList.ThisStaff.Find(StaffID);
                staffList.ThisStaff = staff;
                staffList.Update();
            }
            //redirect to the aTutor page
            Response.Redirect("Staffing_List.aspx");
        }
        else
        {
            txtError.Visible = true;
            //display the error message
            txtError.Text = "Error! " + Error;
        }
    }
コード例 #9
0
ファイル: tstStaffing.cs プロジェクト: xIMzEr/DeMon_Tutoring
        public void DateAddedExtremeMax()
        {
            //Create an instance of staffing
            Staffing aStaff = new Staffing();
            //string variable to store any error message
            String Error = "";
            //Test data to pass the method
            DateTime TestDate;

            //Set the date to the Minimum Date
            TestDate = DateTime.Now.Date;
            //Remove 68 years as Min Date
            TestDate = TestDate.AddYears(100);
            //Change to a string for the Valid Method
            string staffDOBTest = TestDate.ToString();

            //Invoke the method
            Error = aStaff.Valid(staffFN, staffLN, staffEmail, staffNumber, staffDOBTest);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }