Example #1
0
        public void CustInstanceOK()

        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //test to see that it exits
            Assert.IsNotNull(ACustomer);
        }
Example #2
0
 public void CustPassword()
 {
     //create an instance of the class we want to create
     clsCustomer ACustomer = new clsCustomer();
     //Create some test data to assign to the property
     string APassword = "******";
     //assign the data to the property
     ACustomer.Password = APassword;
     //test to see that the two values are the same
     Assert.AreEqual(ACustomer.Password, APassword);
 }
Example #3
0
 public void CustFirstName()
 {
     //create an instance of the class we want to create
     clsCustomer ACustomer = new clsCustomer();
     //Create some test data to assign to the property
     string AFirstName = "Peter";
     //assign the data to the property
     ACustomer.FirstName = AFirstName;
     //test to see that the two values are the same
     Assert.AreEqual(ACustomer.FirstName, AFirstName);
 }
Example #4
0
        public void CustPhoneNo()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //Create some test data to assign to the property
            String PhoneNumber = "07123123123";
            //assign the data to the property
            ACustomer.PhoneNo = PhoneNumber;
            //test to see that the two values are the same
            Assert.AreEqual(ACustomer.PhoneNo, PhoneNumber);

        }
Example #5
0
        public void CustCustomerNo()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //Create some test data to assign to the property
            Int32 Number = 1;
            //assign the data to the property
            ACustomer.CustomerNo = Number;
            //test to see that the two values are the same
            Assert.AreEqual(ACustomer.CustomerNo, Number);

        }
Example #6
0
        public clsCustomerCollection()
        {
            //var for the index
            Int32 Index = 0;
            //var to store the record count
            Int32 RecordCount = 0;
            //object for the data connection
            clsDataConnection DB = new clsDataConnection();
            //execute the stored procedure
            DB.Execute("sproc_tblCustomer_SelectAll");
            //get the count of records
            RecordCount = DB.Count;
            //while there are records to proccess
            while (Index < RecordCount)
            {
                //create a blank customer
                clsCustomer ACustomer = new clsCustomer();
                //read in the fields from the current record
                ACustomer.CustomerNo = Convert.ToInt32(DB.DataTable.Rows[Index]["CustomerNo"]);
                ACustomer.FirstName = Convert.ToString(DB.DataTable.Rows[Index]["FirstName"]);
                ACustomer.LastName = Convert.ToString(DB.DataTable.Rows[Index]["LastName"]);
                ACustomer.AddressLine1 = Convert.ToString(DB.DataTable.Rows[Index]["AddressLine1"]);
                ACustomer.AddressLine2 = Convert.ToString(DB.DataTable.Rows[Index]["AddressLine2"]);
                ACustomer.Town = Convert.ToString(DB.DataTable.Rows[Index]["Town/City"]);
                ACustomer.PostCode = Convert.ToString(DB.DataTable.Rows[Index]["PostCode"]);
                ACustomer.EmailAddress = Convert.ToString(DB.DataTable.Rows[Index]["EmailAddress"]);
                ACustomer.UserName = Convert.ToString(DB.DataTable.Rows[Index]["UserName"]);
                ACustomer.Password = Convert.ToString(DB.DataTable.Rows[Index]["Password"]);
                ACustomer.PhoneNo = Convert.ToString(DB.DataTable.Rows[Index]["PhoneNo"]);
                //add the record to the private data member
                customerList.Add(ACustomer);
                //point at the next record
                Index++;

            }
        }
Example #7
0
 public void CustAddressLine1Mid()
 {
     //create an instance of the class we want to create
     clsCustomer ACustomer = new clsCustomer();
     //Boolean variable to store the result of the validation
     Boolean OK = false;
     //create some test data to use with the method
     String FirstName = "Peter";
     String LastName = "Anderson";
     String AddressLine1 = "";
     AddressLine1 = AddressLine1.PadRight(25, 'a');
     String AddressLine2 = "Test";
     String Town = "Test";
     String PostCode = "LE3 0QT";
     String EmailAddress = "*****@*****.**";
     String PhoneNo = "07123123123";
     String UserName = "******";
     String Password = "******";
     //invoke the mothod
     OK = ACustomer.Valid(FirstName, LastName, AddressLine1, PhoneNo, AddressLine2, Town,
                          PostCode, EmailAddress, UserName, Password);
     //test to see if the result is correct
     Assert.IsTrue(OK);
 }
Example #8
0
        public void CustEmailAddress()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //Create some test data to assign to the property
            string AEmailAddress = "*****@*****.**";
            //assign the data to the property
            ACustomer.EmailAddress = AEmailAddress;
            //test to see that the two values are the same
            Assert.AreEqual(ACustomer.EmailAddress, AEmailAddress);

        }
Example #9
0
 public void CustUserNameFound()
 {
     //create an instance of the class we want to create
     clsCustomer ACustomer = new clsCustomer();
     //Boolean variable to store the result of the validation
     Boolean Found = false;
     //boolean variable to record if data is OK (assume it is)
     Boolean OK = true;
     //create some test data to use with the method
     Int32 CustomerNo = 21;
     //invoke the mothod
     Found = ACustomer.Find(CustomerNo);
     //chech the address no
     if (ACustomer.UserName != "TestUserName")
     {
         OK = false;
     }
     //test to see if the result is correct
     Assert.IsTrue(OK);
 }
Example #10
0
 public void CustFindMethodOK()
 {
     //create an instance of the class we want to create
     clsCustomer ACustomer = new clsCustomer();
     //Boolean variable to store the result of the validation
     Boolean Found = false;
     //create some test data to use with the method
     Int32 CustomerNo = 21;
     //invoke the mothod
     Found = ACustomer.Find(CustomerNo);
     //test to see if the result is correct
     Assert.IsTrue(Found);
 }
Example #11
0
        public void CustTown ()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //Create some test data to assign to the property
            string ATown = "London";
            //assign the data to the property
            ACustomer.Town = ATown;
            //test to see that the two values are the same
            Assert.AreEqual(ACustomer.Town, ATown);

        }
Example #12
0
        public void CustPostCode()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //Create some test data to assign to the property
            string APostcode = "SE28 8EU";
            //assign the data to the property
            ACustomer.PostCode = APostcode;
            //test to see that the two values are the same
            Assert.AreEqual(ACustomer.PostCode, APostcode);

        }
Example #13
0
        public void CustAddressLine2()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //Create some test data to assign to the property
            string AAddressLine2 = "Thamesmead";
            //assign the data to the property
            ACustomer.AddressLine2 = AAddressLine2;
            //test to see that the two values are the same
            Assert.AreEqual(ACustomer.AddressLine2, AAddressLine2);

        }