Example #1
0
        public void HomeAddressMaxLessOne()
        {
            clsStaff staff       = new clsStaff();
            String   Error       = "";
            string   HomeAddress = "";

            HomeAddress = HomeAddress.PadRight(199, 'a');
            Error       = staff.Valid(FirstName, LastName, EmailAddress, HomeAddress, StartDate);
            Assert.AreEqual(Error, "");
        }
        public void StaffAddressExtremeMax()
        {
            clsStaff AStaff       = new clsStaff();
            String   error        = "";
            string   StaffAddress = "";

            StaffAddress.PadRight(500, 'a');
            error = AStaff.Valid(StaffName, StaffAddress, StartDate, Salary);
            Assert.AreNotEqual(error, "");
        }
Example #3
0
        public void HomeAddressExtremeMax()
        {
            clsStaff staff       = new clsStaff();
            String   Error       = "";
            string   HomeAddress = "";

            HomeAddress = HomeAddress.PadRight(500, 'a');
            Error       = staff.Valid(FirstName, LastName, EmailAddress, HomeAddress, StartDate);
            Assert.AreNotEqual(Error, "");
        }
Example #4
0
        public void ValidMethodOK()
        {
            clsStaff Staff = new clsStaff();
            //string variable to store error message
            string Error = "";

            //invoke the method
            Error = Staff.Valid(FullName, DateOfBirth, Address, ContactNo);
            //test to see that result is correct
            Assert.AreEqual(Error, "");
        }
Example #5
0
        public void DOBMax()
        {
            clsStaff staff = new clsStaff();
            string   Error = "";
            DateTime TestDate;

            TestDate = DateTime.Now.Date;
            DOB      = TestDate.ToString();
            Error    = staff.Valid(ID, Name, Address, DOB, Manager);
            Assert.AreEqual(Error, "");
        }
        public void SalaryMax()

        {
            clsStaff AStaff    = new clsStaff();
            string   Error     = "";
            Decimal  SalaryMax = Decimal.MaxValue;
            string   Salary    = SalaryMax.ToString();

            Error = AStaff.Valid(Name, Email, Hire_Date, Salary);
            Assert.AreEqual(Error, "");
        }
Example #7
0
        public void PriceMax()
        {
            clsStaff AStock = new clsStaff();
            string   Error  = "";
            Decimal  TestData;

            TestData = decimal.MaxValue;
            string Price = TestData.ToString();

            Error = AStock.Valid(ProductId, ProductDescription, InStock, LastRestockDate, Price, ProductName, StockVariants); Assert.AreEqual(Error, "");
        }
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //create a string variable to store the result of the validation
            string Error = "";

            //invoke the method
            Error = AStaff.Valid(Name, Phonenum, Salary, DateJoined);
            //test to see that the two values are the same
            Assert.AreEqual(Error, "");
        }
Example #9
0
        public void StockVariantsExtremeMax()
        {
            clsStaff AStock = new clsStaff();
            string   Error  = "";
            Int32    TestData;

            TestData = 5000;
            string StockVariants = TestData.ToString();

            Error = AStock.Valid(ProductId, ProductDescription, InStock, LastRestockDate, Price, ProductName, StockVariants);
            Assert.AreNotEqual(Error, "");
        }
Example #10
0
        public void InStockMaxPlusOne()
        {
            clsStaff AStock = new clsStaff();
            string   Error  = "";
            Int32    TestData;

            TestData = 101;
            string InStock = TestData.ToString();

            Error = AStock.Valid(ProductId, ProductDescription, InStock, LastRestockDate, Price, ProductName, StockVariants);
            Assert.AreNotEqual(Error, "");
        }
Example #11
0
        public void ProductIdMid()
        {
            clsStaff AStock = new clsStaff();
            string   Error  = "";
            Int32    TestData;

            TestData = 25;
            string ProductId = TestData.ToString();

            Error = AStock.Valid(ProductId, ProductDescription, InStock, LastRestockDate, Price, ProductName, StockVariants);
            Assert.AreEqual(Error, "");
        }
Example #12
0
        public void ValidMethodOK()
        {
            //A new instance of a class is created
            clsStaff Record = new clsStaff();
            //String variable is used to store any error message
            String Error = "";

            //Method is invoked
            Error = Record.Valid(tstFullName, tstStaffPwd, tstSalary, tstDateOfBirth);
            //test to see if the result is correct
            Assert.AreEqual(Error, "");
        }
        public void StartDateNotValid()
        {
            clsStaff AStaff       = new clsStaff();
            String   error        = "";
            string   StaffName    = "Matthew Smith";
            string   StaffAddress = "15 somewhere road";
            string   salary       = Convert.ToString(1500);
            string   StartDate    = "Not a date";

            error = AStaff.Valid(StaffName, StaffAddress, StartDate, Salary);
            Assert.AreNotEqual(error, "");
        }
Example #14
0
        public void JoinedDateMin()
        {
            clsStaff AnStaff = new clsStaff();
            String   Error   = "";
            DateTime TestJoinedDate;

            TestJoinedDate = DateTime.Now.Date;
            string JoinedDate = TestJoinedDate.ToString();

            Error = AnStaff.Valid(Name, PhoneNum, Salary, JoinedDate);
            Assert.AreEqual(Error, "");
        }
Example #15
0
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //string variable to store any error message
            String Error = "";

            //invoke method
            Error = AStaff.Valid(FirstName, LastName, DateOfBirth, Department, Email, Password);
            //test to see the result is correct
            Assert.AreEqual(Error, "");
        }
Example #16
0
        public void DOBExtremeMin()
        {
            clsStaff staff = new clsStaff();
            String   error = "";
            DateTime tstDate;

            tstDate     = DateTime.Now.Date;
            tstDate     = tstDate.AddYears(-100);
            DateOfBirth = tstDate.ToString();
            error       = staff.Valid(FullName, DateOfBirth, Address, ContactNo);
            Assert.AreNotEqual(error, "5");
        }
        //used to test the valid method of the class
        public void ValidMethod()
        {
            //create an instance of the class
            clsStaff AStaff = new clsStaff();
            //create a string variable to store the result of the validation
            string Error = "";

            //create some test data to test the method
            Error = AStaff.Valid(SomeEmail, SomeName, SomePassword);
            //test to see the result is ok. i.e there was no error mssage returned
            Assert.AreEqual(Error, "");
        }
Example #18
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        clsStaff Staff = new clsStaff();

        string StaffID     = txtStaffID.Text;
        string FullName    = txtFullName.Text;
        string DateOfBirth = txtDateOfBirth.Text;
        string Address     = txtAddress.Text;
        string ContactNo   = txtContactNo.Text;
        string error       = "";

        error = Staff.Valid(FullName, DateOfBirth, Address, ContactNo);
        if (error == "")
        {
            //capture all information below
            Staff.StaffID     = Convert.ToInt32(StaffID);
            Staff.FullName    = FullName;
            Staff.DateOfBirth = Convert.ToDateTime(DateOfBirth);
            Staff.Address     = Address;
            Staff.ContactNo   = ContactNo;
            Staff.LoggedInOut = LoggedInOut.Checked;
            //create instance of collection class
            clsStaffCollection staffList = new clsStaffCollection();

            if (SID == -1)
            {
                //set thisStaff property
                staffList.thisStaff = Staff;
                //add the new record
                staffList.Add();
            }
            else
            {
                staffList.thisStaff.Find(SID);
                //set this staff property
                staffList.thisStaff = Staff;
                staffList.Update();
            }

            //redirect back to list page
            Response.Redirect("StaffList.aspx");

            //store address in session object
            //Session["Staff"] = Staff;
            //redirect to viewer page
            //Response.Write("StaffViewer.aspx");
        }

        else
        {
            lblError.Text = error;
        }
    }
        public void StartDateMin()
        {
            clsStaff AStaff = new clsStaff();
            String   error  = "";
            DateTime TestDate;

            TestDate = DateTime.Now.Date;
            string StartDate = TestDate.ToString();

            error = AStaff.Valid(StaffName, StaffAddress, StartDate, Salary);
            Assert.AreEqual(error, "");
        }
Example #20
0
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //string variable to store any error message
            String Error = "";

            //invoke the method
            Error = AStaff.Valid(FullName, Salary, DateOfJoining, Position);
            //test to see if the result is correct
            Assert.AreEqual(Error, "");
        }
Example #21
0
        public void ValidMethodOk()
        {
            // Create new instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            // String varaible to store error message
            String Error = " ";

            // Invoke the method
            Error = AStaff.Valid(StaffId, FullName, DateOfBirth, HourlyWage, PhoneNumber);
            // test
            Assert.AreEqual(Error, " ");
        }
Example #22
0
        public void ValidMethodOK()
        {
            //create an instance of the class
            clsStaff AStaff = new clsStaff();
            //string variable to store any error message
            String Error = "";

            //invoke the method
            Error = AStaff.Valid(FirstName, LastName, AddressLine, PostCode, PhoneNo);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Example #23
0
        public void StartDateMin()
        {
            clsStaff staff = new clsStaff();
            String   Error = "";
            DateTime TestDate;

            TestDate = DateTime.Now.Date;
            string StartDate = TestDate.ToString();

            Error = staff.Valid(FirstName, LastName, EmailAddress, HomeAddress, StartDate);
            Assert.AreEqual(Error, "");
        }
Example #24
0
        public void ValidMethodOK()
        {
            //Creates an instance of the class we want to create
            clsStaff AnStaff = new clsStaff();
            //String variable to store an error
            String Error = "";

            //Invoke the method
            Error = AnStaff.Valid(StaffPosition, StaffID, FirstName, StartDate, DateOfBirth);
            //Test to see the result is correct
            Assert.AreEqual(Error, "");
        }
Example #25
0
        public void LastRestockDateMax()
        {
            clsStaff AStock = new clsStaff();
            string   Error  = "";
            DateTime TestDate;

            TestDate = DateTime.Now.Date;
            string LastRestockDate = TestDate.ToString();

            Error = AStock.Valid(ProductId, ProductDescription, InStock, LastRestockDate, Price, ProductName, StockVariants);
            Assert.AreEqual(Error, "");
        }
Example #26
0
        public void passwordMid()
        {
            clsStaff AStaff = new clsStaff();

            String Error = "";

            string password = "******";

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

            Assert.AreEqual(Error, "");
        }
Example #27
0
        public void ValidMethodOkay()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //string variable to store any error message
            String Error = "";

            //Invoke the method
            Error = AStaff.Valid(Name, JobRole, Email, DateStarted);
            //test to see if the results are correct
            Assert.AreEqual(Error, "");
        }
Example #28
0
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //string variable to store any error message
            String Error = "";

            //invoke the method
            Error = AStaff.Valid(StaffName, StaffAddress, StaffTelNumber, DateJoined, StaffID);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Example #29
0
        public void passwordMaxPlusOne()
        {
            clsStaff AStaff = new clsStaff();

            String Error = "";

            string password = ""; //this should be ok

            //invoke the method
            Error = AStaff.Valid(firstName, surname, dateOfBirth, password);

            Assert.AreNotEqual(Error, "");
        }
        public void SalaryMinPlusOne()

        {
            clsStaff AStaff    = new clsStaff();
            string   Error     = "";
            Decimal  SalaryMin = 0;

            SalaryMin = SalaryMin + (Decimal)0.01;
            string Salary = SalaryMin.ToString();

            Error = AStaff.Valid(Name, Email, Hire_Date, Salary);
            Assert.AreEqual(Error, "");
        }