Пример #1
0
        public void ValidMethodOK()
        {
            clsMember AMember = new clsMember();
            string    Error   = "";

            Error = AMember.Valid(FullName, Address, DOB, PhoneNumber);
            Assert.AreEqual(Error, "");
        }
Пример #2
0
        public void PhoneNumberNotBlank()
        {
            clsMember AMember     = new clsMember();
            String    Error       = "";
            string    PhoneNumber = "";

            Error = AMember.Valid(FullName, Address, DOB, PhoneNumber);
            Assert.AreNotEqual(Error, "");
        }
Пример #3
0
        public void PhoneNumberMaxMinusOne()
        {
            clsMember AMember     = new clsMember();
            String    Error       = "";
            string    PhoneNumber = "AAAAAAAAAAAAAA";

            Error = AMember.Valid(FullName, Address, DOB, PhoneNumber);
            Assert.AreEqual(Error, "");
        }
Пример #4
0
        public void AddressExtremeMax()
        {
            clsMember AMember = new clsMember();
            String    Error   = "";
            string    Address = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";

            Error = AMember.Valid(FullName, Address, DOB, PhoneNumber);
            Assert.AreNotEqual(Error, "");
        }
Пример #5
0
        public void AddressMinBoundary()
        {
            clsMember AMember = new clsMember();
            String    Error   = "";
            string    Address = "AAAAAAAAAA";

            Error = AMember.Valid(FullName, Address, DOB, PhoneNumber);
            Assert.AreEqual(Error, "");
        }
Пример #6
0
        public void DOBInvalidData()
        {
            clsMember AMember = new clsMember();
            String    Error   = "";
            String    DOB     = "this is not a date!";

            Error = AMember.Valid(FullName, Address, DOB, PhoneNumber);
            Assert.AreNotEqual(Error, "");
        }
Пример #7
0
        public void FullNameContainsSpace()
        {
            clsMember AMember  = new clsMember();
            String    Error    = "";
            String    FullName = "AAAAAAAAAAAAAAAAAAAA";

            Error = AMember.Valid(FullName, Address, DOB, PhoneNumber);
            Assert.AreNotEqual(Error, "");
        }
Пример #8
0
        public void FullNameExtremeMin()
        {
            clsMember AMember  = new clsMember();
            String    Error    = "";
            String    FullName = "";

            Error = AMember.Valid(FullName, Address, DOB, PhoneNumber);
            Assert.AreNotEqual(Error, "");
        }
Пример #9
0
        public void AddressMaxBoundary()
        {
            clsMember AMember = new clsMember();
            String    Error   = "";
            string    Address = "";

            Address = Address.PadRight(50, 'a');
            Error   = AMember.Valid(FullName, Address, DOB, PhoneNumber);
            Assert.AreEqual(Error, "");
        }
Пример #10
0
        public void FullNamExtremeMax()
        {
            clsMember AMember  = new clsMember();
            String    Error    = "";
            String    FullName = "";

            FullName = FullName.PadRight(100, 'A') + "";
            Error    = AMember.Valid(FullName, Address, DOB, PhoneNumber);
            Assert.AreNotEqual(Error, "");
        }
Пример #11
0
    protected void bttnOK_Click(object sender, EventArgs e)
    {
        //create a new instance of clsMember
        clsMember AMember = new clsMember();

        //capture all data for validation
        string FullName    = txtbxFullName.Text;
        string Address     = txtbxAddress.Text;
        string DOB         = txtbxDOB.Text;
        string PhoneNumber = txtbxPhoneNumber.Text;
        //variable to store error messages
        string Error = "";

        Error = AMember.Valid(FullName, Address, DOB, PhoneNumber);
        if (Error == "")
        {
            //capture all the data
            AMember.MemberID          = MemberID;
            AMember.FullName          = FullName;
            AMember.Address           = Address;
            AMember.DOB               = Convert.ToDateTime(DOB);
            AMember.PhoneNumber       = PhoneNumber;
            AMember.MedicalConditions = chkbxMedicalConditions.Checked;

            //create a new instance of the Member collection
            clsMemberCollection AllMembers = new clsMemberCollection();

            //if this is a new record  then add the data
            if (MemberID == -1)
            {
                //set the ThisMember property
                AllMembers.ThisMember = AMember;
                //add the new record
                AllMembers.Add();
            }
            else //otherwise it must be an update
            {
                //find the record to update
                AllMembers.ThisMember.Find(MemberID);
                //set the ThisMember property
                AllMembers.ThisMember = AMember;
                //update the record
                AllMembers.Update();
            }

            //redirect back to the listpage
            Response.Redirect("MemberList.aspx");
        }
        else
        {
            lblErrorMessage.Text = Error;
        }
    }
Пример #12
0
        public void DOBExtremeMax()
        {
            clsMember AMember = new clsMember();
            String    Error   = "";
            DateTime  TestDate;

            TestDate = DateTime.Now.Date;
            string DOB = TestDate.AddYears(100).ToString();

            Error = AMember.Valid(FullName, Address, DOB, PhoneNumber);
            Assert.AreNotEqual(Error, "");
        }
Пример #13
0
        public void DOBMaxMinusOne()
        {
            clsMember AMember = new clsMember();
            String    Error   = "";
            DateTime  TestDate;

            TestDate = DateTime.Now.Date;
            string DOB = TestDate.AddYears(-18).AddDays(-1).ToString();

            Error = AMember.Valid(FullName, Address, DOB, PhoneNumber);
            Assert.AreEqual(Error, "");
        }