Example #1
0
        public void AddMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.Over18          = true;
            TestItem.CustomerID      = 1;
            TestItem.CustomerPayment = "Siren Ocean etc.";
            TestItem.CustomerAddress = "Western Road";
            TestItem.SignUpDate      = DateTime.Now.Date;
            TestItem.DateOfBirth     = DateTime.Now.Date;

            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey          = AllCustomers.Add();
            TestItem.CustomerID = PrimaryKey;
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
        public void ThisCustomerPropertyOK()
        {
            //Create an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //Create some test data to assign to the property
            clsCustomer TestItem = new clsCustomer();

            //Set the properties of the test object
            TestItem.FirstName     = "David";
            TestItem.LastName      = "Haddock";
            TestItem.DateOfBirth   = new DateTime(1982, 7, 23);
            TestItem.EmailAddress  = "*****@*****.**";
            TestItem.MobilePhoneNo = 07775828423;
            TestItem.Password      = "******";
            //Assign the data to the property
            AllCustomers.ThisCustomer = TestItem;
            //Test to see that the two values are the same
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
        public void PasswordMid()
        {
            //Create an instance of the class we want toc reate
            clsCustomer ACustomer = new clsCustomer();
            //String variable to store an error message
            String Error = "";
            //Create some test data to pass to the method
            string FirstName     = "David";
            string LastName      = "Haddock";
            string DateOfBirth   = new DateTime(1982, 7, 23).ToString();
            string EmailAddress  = "*****@*****.**";
            string MobilePhoneNo = "07775828423";
            string Password      = "******";

            //Invoke the method
            Error = ACustomer.Valid(FirstName, LastName, DateOfBirth, EmailAddress, MobilePhoneNo, Password);
            //Test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Example #4
0
        public void TestOwnServerFound()
        {
            //create an instance of the class we want to create
            clsCustomer AnCustomer = new clsCustomer();
            //boolean variable to store the result of the search
            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 AddressNo = 21;

            //invoke the method
            Found = AnCustomer.Find(AddressNo);
            //check the property
            if (AnCustomer.Active != true)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
        public void DeleteMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            clsCustomer           TestItem     = new clsCustomer();
            Int32 PrimaryKey = 0;

            TestItem.CustomerNumber   = 1;
            TestItem.CustomerName     = "Michael Smith";
            TestItem.CustomerEmail    = "*****@*****.**";
            TestItem.CustomerDOB      = DateTime.Now.Date;
            TestItem.CustomerGender   = "M";
            TestItem.CustomerPostcode = "LE1 1AB";
            AllCustomers.ThisCustomer = TestItem;
            PrimaryKey = AllCustomers.Add();
            TestItem.CustomerNumber = PrimaryKey;
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            AllCustomers.Delete();
            Boolean Found = AllCustomers.ThisCustomer.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
Example #6
0
        public void TestActiveFound()
        {
            //create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //boolean variable to store theresult of the search
            Boolean Found = false;
            //boolean variable recod if data is ok
            Boolean OK = true;
            //create some test data o use with the method
            Int32 CustomerNo = 21;

            //invoke the method
            Found = ACustomer.Find(CustomerNo);
            //check the customer no
            if (ACustomer.Active != true)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
        public void PasswordFound()
        {
            //Create an instance of the class we want to create
            clsCustomer ACustomer = new clsCustomer();
            //Boolean variable to store the result of the search
            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 CustomerID = 1;

            //Invoke the method
            Found = ACustomer.Find(CustomerID);
            //Check the Password
            if (ACustomer.Password != "Swordfish")
            {
                OK = false;
            }
            //Test to see that the result is correct
            Assert.IsTrue(OK);
        }
        public void CustomerListOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomer = new clsCustomerCollection();
            //create some test data to assgin to th property
            // in this case the data needs to be a list of objects
            List <clsCustomer> TestList = new List <clsCustomer>();
            clsCustomer        TestItem = new clsCustomer();

            //set its properties
            TestItem.CurrentOrder            = true;
            TestItem.CustomerNo              = 1;
            TestItem.CustomerName            = "Jeff";
            TestItem.CustomerEmail           = "*****@*****.**";
            TestItem.CustomerShippingAddress = "23 Doe Zoo";
            TestItem.CustomerBillingAddress  = "23 Doe Zoo";
            TestItem.DateWhenJoined          = DateTime.Now.Date;
            // add the item to the test list
            TestList.Add(TestItem);
            AllCustomer.CustomerList = TestList;
            Assert.AreEqual(AllCustomer.CustomerList, TestList);
        }
Example #9
0
        public void CountMatchesList()
        {
            clsCustomerCollection Customers = new clsCustomerCollection();

            List <clsCustomer> TestList = new List <clsCustomer>();
            clsCustomer        TestItem = new clsCustomer();

            TestItem.CustomerId   = 1;
            TestItem.Forename     = "George";
            TestItem.Surname      = "Mintoft";
            TestItem.Address      = "1 A Street";
            TestItem.County       = "A County";
            TestItem.PostCode     = "AB1 2CD";
            TestItem.EmailAddress = "*****@*****.**";
            TestItem.PhoneNumber  = "0123456789";

            TestList.Add(TestItem);

            Customers.AllCustomers = TestList;

            Assert.AreEqual(Customers.Count, TestList.Count);
        }
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create item of test data
            clsCustomer TestItem = new clsCustomer();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.Active     = true;
            TestItem.CustomerNo = 1;
            TestItem.FirstName  = "John";
            TestItem.Surname    = "Smith";
            TestItem.Email      = "*****@*****.**";
            TestItem.Street     = "Leicester Road";
            TestItem.PostCode   = "LE3 0GH";
            TestItem.HouseNo    = "11A";
            TestItem.PhoneNo    = "07476182329";
            TestItem.DateSold   = DateTime.Now.Date;
            TestItem.Town       = "Leicester";
            //set This Customer to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key to the test data
            TestItem.CustomerNo = PrimaryKey;
            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //delete the record
            AllCustomers.Delete();
            //now find the record
            Boolean Found = AllCustomers.ThisCustomer.Find(PrimaryKey);

            //Test to see the two values are the same
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
        public void ThisCustomerPropertyOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create some test data to assign to the property
            clsCustomer TestCustomer = new clsCustomer();

            //Set the properties of the test object
            TestCustomer.Active     = true;
            TestCustomer.CustomerNo = 1;
            TestCustomer.FirstName  = "John";
            TestCustomer.Surname    = "Smith";
            TestCustomer.Email      = "*****@*****.**";
            TestCustomer.Street     = "Leicester Road";
            TestCustomer.PostCode   = "LE3 0GH";
            TestCustomer.HouseNo    = "11A";
            TestCustomer.PhoneNo    = "07476182329";
            TestCustomer.DateSold   = DateTime.Now.Date;
            TestCustomer.Town       = "Leicester";
            //asssign the sata to the porperty
            AllCustomers.ThisCustomer = TestCustomer;
            //test to see the two values are the same
            Assert.AreEqual(AllCustomers.ThisCustomer, TestCustomer);
        }
Example #12
0
        public void InstanceOK()
        {
            clsCustomer ACustomer = new clsCustomer();

            Assert.IsNotNull(ACustomer);
        }