Esempio n. 1
0
        public void CustomerNameMinPlusOne()
        {
            //create an instance of the class customer
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store error message
            string Error = "";
            //this should pass
            string CName = "Nn";

            //invoke method
            Error = ACustomer.Valid(CName, CDOB, CEmail, CBillingAddress, CPass);
            //test to see if result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 2
0
        public void DOBInvalidData()
        {
            //create an instance of the class
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //set the DOB to a non date value
            string DOB = "this is not a date!";

            //invoke the method
            Error = ACustomer.Valid(FirstName, HouseNumber, DOB, PhoneNo, PostCode, StreetName, Surname);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 3
0
        public void CustomerMinPlusOne()
        {
            //Instance of a class
            clsCustomer ACustomer = new clsCustomer();
            //store result of validation
            Boolean OK = false;
            //create test data
            string SomeEmail = "aa";

            //request method
            OK = ACustomer.Valid(SomeEmail);
            //test
            Assert.IsTrue(OK);
        }
Esempio n. 4
0
        public void EmailAddressMinLessOne()
        {
            //create an instance of the class we want to create
            clsCustomer AnCustomer = new clsCustomer();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //create some test data to assign the property
            string SomeCustomer = "";

            //invoke the method
            OK = AnCustomer.Valid(SomeCustomer);
            //test to see that the result is ok
            Assert.IsFalse(OK);
        }
Esempio n. 5
0
        public void DateOfBirthMaxLessOne()
        {
            clsCustomer ACustomer = new clsCustomer();
            String      Error     = "";
            DateTime    TestDate;

            TestDate = DateTime.Now.Date;
            TestDate = TestDate.AddYears(-13);
            TestDate = TestDate.AddDays(-1);
            String DateOfBirth = TestDate.ToString();

            Error = ACustomer.Valid(Name, DateOfBirth, Address, Email);
            Assert.AreEqual(Error, "");
        }
Esempio n. 6
0
        public void DateJoinedInvalidDate()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //string varaible to store the results of the validation
            String Error = "";
            //set the datejoined to a non date value
            string DateJoined = "this is not a date!";

            //invoke the method
            Error = ACustomer.Valid(CustomerID, CustomerName, CustomerTelNumber, CustomerAddress, DateJoined);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 7
0
        public void CustomerIDMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //this should fail
            string CustomerID = "501";

            //invoke the method
            Error = ACustomer.Valid(CustomerID, CustomerName, CustomerTelNumber, CustomerAddress, DateJoined);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 8
0
        public void PhoneNumberMinPlus()
        {
            //create an instance of the class we want to create
            clsCustomer Customer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //this should pass
            string PhoneNumber = "aa";

            //invoke the method
            Error = Customer.Valid(FullName, Address, PostCode, Email, Date, PhoneNumber);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 9
0
        public void CustomerCardNumberMaxPlusOne()
        {
            //create instance of clsCustomer
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //test data
            string CustomerCardNumber = "12345678910123456"; //this should trigger an error

            //invoke the method
            Error = ACustomer.Valid(CustomerName, CustomerEmail, CustomerPassword, CustomerCardNumber, CustomerCreationDate);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 10
0
        public void DateOfBirthInvalidData()
        {
            //create an instance of the class we want to create
            clsCustomer AnCustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //set the SignUpDtate to a non date value
            string DateOfBirth = "this is not a date!";

            //invoke the method
            Error = AnCustomer.Valid(CustomerAddress, CustomerPayment, SignUpDate, DateOfBirth);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 11
0
        public void DateInvalidData()
        {
            //create an instance of the class we want to create
            clsCustomer Customer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //convert the date variable to a string variable
            string Date = "This is NOT a date";

            //invoke the method
            Error = Customer.Valid(FullName, Address, PostCode, Email, Date, PhoneNumber);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 12
0
        public void CustomerPaymentMid()
        {
            //create an instance of the class we want to create
            clsCustomer AnCustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string CustomerPayment = "aaa"; //this should be ok

            //invoke the method
            Error = AnCustomer.Valid(CustomerAddress, CustomerPayment, SignUpDate, DateOfBirth);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 13
0
        public void CustomerMinPlusOne()
        {
            //create an instance of the class that we want to create
            clsCustomer AnCustomer = new clsCustomer();
            //create a string variable to store the result of the validation
            String Error = "";
            //create some test data to test the method
            string SomeCustomer = "";

            //invoke the method
            Error = AnCustomer.Valid(SomeCustomer);
            //test to see that the resul is NOT OK i.e there should be an error message
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 14
0
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomer AnCustomer = new clsCustomer();
            //create a string variable to store the result of the validation
            String Error = "";
            //create some test data to test the method
            string SomeCustomer = "Sonny";

            //invoke the mehtod
            Error = AnCustomer.Valid(SomeCustomer);
            //test to see that the result is OK i.e there was no error message returned
            Assert.AreEqual(Error, "");
        }
Esempio n. 15
0
        public void CustomerDOBInvalidData()
        {
            //create an instance of clsCustomer
            clsCustomer ACustomer     = new clsCustomer();
            String      Error         = "";
            string      CustomerName  = "Tobias Jenkins";
            string      CustomerEmail = "*****@*****.**";
            string      CustomerDOB   = "this is not a date";

            //invoke method
            Error = ACustomer.Valid(CustomerName, CustomerEmail, CustomerDOB);
            //test to see the correct result
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 16
0
        public void CustomerCreationDateInvalidData()
        {
            //create instance of clsCustomer
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //test data
            string CustomerCreationDate = "this is not a date!";

            //invoke the method
            Error = ACustomer.Valid(CustomerName, CustomerEmail, CustomerPassword, CustomerCardNumber, CustomerCreationDate);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 17
0
        public void CustomerNameMaxLessOne()
        {
            //create an instance of clsCustomer
            clsCustomer ACustomer = new clsCustomer();
            //create test data for error message
            String Error = "";
            //create test data to pass the method
            string CustomerName = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

            //invoke method
            Error = ACustomer.Valid(CustomerName, CustomerEmail, CustomerDOB);
            //test to see the correct result
            Assert.AreEqual(Error, "");
        }
Esempio n. 18
0
        public void DobInvalidData()
        {
            //create an instance of the clas we want to create
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store any Error message
            String Error = "";
            //set the DateAdded to a non date value
            string Dob = "this is not a date";

            //invoke the method
            Error = ACustomer.Valid(Name, Address, Postcode, Dob);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 19
0
        public void CustomerTelNumberMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //string varaible to store the results of the validation
            String Error = "";
            //create some test data to pass to the method
            string CustomerTelNumber = "0123456789012";

            //invoke the method
            Error = ACustomer.Valid(CustomerID, CustomerName, CustomerTelNumber, CustomerAddress, DateJoined);
            //test to see if the results is true
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 20
0
        public void DateAddedInvalidData()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //set the DateAdded to a non date value
            string DateAdded = "this is not a date!";

            //invoke the method
            Error = ACustomer.Valid(Title, ForeName, LastName, Email, PhoneNo, DateAdded);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 21
0
        public void LastNameMid()
        {
            //create an instance of the class we want to create
            clsCustomer AnCustomer = new clsCustomer();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //create some test data to assign the property
            string SomeCustomer = "abcdefghijabcdefghijabcde";

            //invoke the method
            OK = AnCustomer.Valid(SomeCustomer);
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
Esempio n. 22
0
        public void EmailMaxLessOne()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string Email = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; //this should trigger an error

            //invoke the method
            Error = ACustomer.Valid(Title, ForeName, LastName, Email, PhoneNo, DateAdded);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 23
0
        public void CustomerTeleNoMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string CustomerTeleNo = "aaaaaaaaaaaaaaaa"; //this should be ok

            //invoke the method
            Error = ACustomer.Valid(CustomerFirstName, CustomerLastName, CustomerEmail, CustomerTeleNo);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 24
0
        public void PhoneNoExtremeMin()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string PhoneNo = "";

            //invoke the method
            Error = ACustomer.Valid(Title, ForeName, LastName, Email, PhoneNo, DateAdded);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Esempio n. 25
0
        public void FirstNameMinLessOne()
        {
            //create an insatnce of the class
            clsCustomer ACustomer = new clsCustomer();
            //string varibale to store any error message
            String Error = "";
            //create some test data to pass to the method
            string FirstName = ""; //this should be ok

            //invoke the method
            Error = ACustomer.Valid(FirstName, HouseNumber, DOB, PhoneNo, PostCode, StreetName, Surname);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
    protected void btnOk_Click(object sender, EventArgs e)
    {
        //create new instance of customer class
        clsCustomer AnCustomer = new clsCustomer();
        //capture the name
        string  Name       = txtCName.Text;
        int     CustomerNo = int.Parse(txtCustomerNo.Text);
        string  Surname    = txtCSurname.Text;
        string  Mail       = txtCMail.Text;
        string  Address    = txtCAddress.Text;
        string  Error      = "";
        Boolean Active     = true;

        Error = AnCustomer.Valid(CustomerNo, Name, Surname, Mail, Address, Active);

        if (Error == "")
        {
            AnCustomer.CustomerNo = CustomerNo;
            AnCustomer.Name       = Name;
            AnCustomer.Surname    = Surname;
            AnCustomer.Mail       = Mail;
            AnCustomer.Address    = Address;
            AnCustomer.Active     = chkActive.Checked;

            clsCustomerCollection CustomerList = new clsCustomerCollection();

            if (CustomerNo == -1)
            {
                CustomerList.ThisCustomer = AnCustomer;

                CustomerList.Add();
            }
            else
            {
                CustomerList.ThisCustomer.Find(CustomerNo);

                CustomerList.ThisCustomer = AnCustomer;


                CustomerList.Update();
            }


            Response.Redirect("CustomerList.aspx");
        }
        else
        {
            lblError.Text = Error;
        }
    }
Esempio n. 27
0
        public void ValidMethodOK()
        {
            //Instance of a class
            clsCustomer ACustomer = new clsCustomer();
            //store result of validation
            Boolean OK = false;
            //create test data
            string SomeEmail = "*****@*****.**";

            //request method
            OK = ACustomer.Valid(SomeEmail);
            //test
            Assert.IsTrue(OK);
        }
Esempio n. 28
0
        public void PhoneNumberMid()
        {
            //create an instance of the class we want to create
            clsCustomer AnCustomer = new clsCustomer();
            //boolean variable to store the result of the validation
            string Error = "";

            //create some test data to assign the property
            PhoneNumber = "abcdefghijabcdefghijabcde";
            //invoke the method
            Error = AnCustomer.Valid(FirstName, LastName, Address, PostCode, DateAdded, EmailAddress, PhoneNumber);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 29
0
        public void AddressMin()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string Address = "a"; //this should be ok

            //invoke the method
            Error = ACustomer.Valid(Email, DateOfBirth, Address, Name, Password);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 30
0
        public void CustomerDateOfBirthInvalidData()
        {
            //create an instance of the class customer
            clsCustomer ACustomer = new clsCustomer();
            // string variable to store error message
            string Error = "";
            //set the date of birth to a non date value
            string CDOB = "This is not a date!";

            //invoke method
            Error = ACustomer.Valid(CName, CDOB, CEmail, CBillingAddress, CPass);
            //test to see if result is correct
            Assert.AreNotEqual(Error, "");
        }