예제 #1
0
        public void AddMethodOK()
        {
            clsCustomerCollection AllCustomers = new clsCustomerCollection();

            clsCustomers TestItem = new clsCustomers();

            Int32 PrimaryKey = 0;

            TestItem.active      = true;
            TestItem.customer_id = 1;
            TestItem.first_name  = "Bilbo";
            TestItem.last_name   = "Baggins";
            TestItem.email       = "*****@*****.**";
            TestItem.create_date = DateTime.Now.Date;

            AllCustomers.ThisCustomer = TestItem;

            PrimaryKey = AllCustomers.Add();

            TestItem.customer_id = PrimaryKey;

            AllCustomers.ThisCustomer.Find(PrimaryKey);

            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
예제 #2
0
        public void ValidMethodOK()
        {
            clsCustomers ACustomer = new clsCustomers();
            String       Error     = "";

            Error = ACustomer.Valid(firstName, lastName, email, createDate);
        }
예제 #3
0
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create the item of test data
            clsCustomers TestItem = new clsCustomers();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.CustomerNo  = 13;
            TestItem.FirstName   = "Amy";
            TestItem.Surname     = "Gray ";
            TestItem.Address1    = "10 low street ";
            TestItem.Address2    = "15 dowing street";
            TestItem.Postcode    = "le5 7du";
            TestItem.PhoneNumber = "04452662121";
            TestItem.Email       = "*****@*****.**";
            //set ThisCustomer to the test data
            AllCustomers.ThisCustomer = TestItem;
            //add the record
            PrimaryKey = AllCustomers.Add();
            //set the primary key of the test data
            TestItem.CustomerNo = PrimaryKey;
            //find the record
            AllCustomers.ThisCustomer.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomers.ThisCustomer, TestItem);
        }
예제 #4
0
        public void ListAndCount()
        {
            //creat an instance of the class we want to create
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of objects
            List <clsCustomers> TestList = new List <clsCustomers>();
            //add an item to the list
            //create the item of the test data
            clsCustomers TestItem = new clsCustomers();

            //set its properties
            TestItem.CustomerNo  = 4;
            TestItem.FirstName   = "Sonia";
            TestItem.Surname     = "Ruskhar ";
            TestItem.Address1    = "20 low street ";
            TestItem.Address2    = "15 dowing street";
            TestItem.Postcode    = "le5 7du";
            TestItem.PhoneNumber = "04452662121";
            TestItem.Email       = "*****@*****.**";
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllCustomers.CustomerList = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomers.Count, TestList.Count);
        }
        public void ListAndCountOK()
        {
            //create an instance of the class we want to create
            clsCustomersCollection AllCustomers = new clsCustomersCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of objects
            List <clsCustomers> TestList = new List <clsCustomers>();
            //add an item to the list
            //create the item of test data
            clsCustomers TestItem = new clsCustomers();

            //set its properties
            TestItem.Active     = true;
            TestItem.CustomerNo = 1;
            TestItem.FirstName  = "John";
            TestItem.LastName   = "Smith";
            TestItem.DOB        = DateTime.Now.Date.AddYears(-18);
            TestItem.Email      = "*****@*****.**";
            TestItem.PhoneNo    = "07865432345";
            TestItem.DateAdded  = DateTime.Now.Date;
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllCustomers.CustomersList = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomers.Count, TestList.Count);
        }
예제 #6
0
        public void LastNamePropertyOK()
        {
            clsCustomers ACustomer = new clsCustomers();
            string       TestData  = "Bloggs";

            ACustomer.last_name = TestData;
            Assert.AreEqual(ACustomer.last_name, TestData);
        }
예제 #7
0
        public void FirstNamePropertyOK()
        {
            clsCustomers ACustomer = new clsCustomers();
            string       TestData  = "Joe";

            ACustomer.first_name = TestData;
            Assert.AreEqual(ACustomer.first_name, TestData);
        }
예제 #8
0
        public void CustomerIDPropertyOK()
        {
            clsCustomers ACustomer = new clsCustomers();
            int          TestData  = 0;

            ACustomer.customer_id = TestData;
            Assert.AreEqual(ACustomer.customer_id, TestData);
        }
예제 #9
0
        public void InstanceOK()
        {
            //created an instance of the class
            clsCustomers customer = new clsCustomers();

            // test to make sure it exists
            Assert.IsNotNull(customer);
        }
예제 #10
0
        public void InstanceOK()
        {
            //create an instance of the class we want to create
            clsCustomers ACustomer = new clsCustomers();

            //test to see that it exists
            Assert.IsNotNull(ACustomer);
        }
예제 #11
0
        public void ActivePropertyOK()
        {
            clsCustomers ACustomer = new clsCustomers();
            Boolean      TestData  = true;

            ACustomer.active = TestData;
            Assert.AreEqual(ACustomer.active, TestData);
        }
예제 #12
0
        public void EmailPropertyOK()
        {
            clsCustomers ACustomer = new clsCustomers();
            string       TestData  = "*****@*****.**";

            ACustomer.email = TestData;
            Assert.AreEqual(ACustomer.email, TestData);
        }
예제 #13
0
        public void CreateDatePropertyOK()
        {
            clsCustomers ACustomer = new clsCustomers();
            DateTime     TestData  = DateTime.Now.Date;

            ACustomer.create_date = TestData;
            Assert.AreEqual(ACustomer.create_date, TestData);
        }
예제 #14
0
        public void FindMethodOK()
        {
            clsCustomers ACustomer = new clsCustomers();
            Boolean      Found     = false;

            Int32 CustomerNum = 1;

            Found = ACustomer.Find(CustomerNum);
            Assert.IsTrue(Found);
        }
예제 #15
0
        public void DateAddedInvalidData()
        {
            clsCustomers ACustomer = new clsCustomers();

            String Error      = "";
            string createDate = "this is not a date!";

            Error = ACustomer.Valid(firstName, lastName, email, createDate);

            Assert.AreNotEqual(Error, "");
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        clsCustomers ACustomer = new clsCustomers();

        ACustomer = (clsCustomers)Session["ACustomer"];
        Response.Write(ACustomer.first_name + "<br>");
        Response.Write(ACustomer.last_name + "<br>");
        Response.Write(ACustomer.email + "<br>");
        Response.Write(ACustomer.active + "<br>");
        Response.Write(ACustomer.create_date);
    }
예제 #17
0
        public void CustomerIdOK()
        {
            //create an instance of the class we want to create
            clsCustomers customer = new clsCustomers();
            //create some test data to assign to the property
            Int32 TestData = 1;

            //assign the data to the property
            customer.CustomerID = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(customer.CustomerID, TestData);
        }
예제 #18
0
        public void emailIncorrectFormat()
        {
            clsCustomers ACustomer = new clsCustomers();
            String       Error     = "";
            string       email     = "";

            email = "Testing wrong email";

            Error = ACustomer.Valid(firstName, lastName, email, createDate);

            Assert.AreNotEqual(Error, "");
        }
예제 #19
0
        public void AddressPropertyOK()
        {
            //Create an instance of the class we want to create
            clsCustomers ACustomer = new clsCustomers();
            //Create some test data to aaign to the property
            string TestData = "33, Some Street, Some City, Some Postcode";

            //assign the data to the property
            ACustomer.Address = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(ACustomer.Address, TestData);
        }
예제 #20
0
        public void NamePropertyOK()
        {
            //Create an instance of the class we want to create
            clsCustomers ACustomer = new clsCustomers();
            //Create some test data to aaign to the property
            string TestData = "A Name";

            //assign the data to the property
            ACustomer.Name = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(ACustomer.Name, TestData);
        }
예제 #21
0
        public void ActivePropertyOK()
        {
            //create an instance of the class we want to create
            clsCustomers ACustomer = new clsCustomers();
            //create some test data to assign to the property
            Boolean TestData = true;

            //assign data to the property
            ACustomer.PremiumMember = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(ACustomer.PremiumMember, TestData);
        }
예제 #22
0
        public void DateAddedPropertyOK()
        {
            //create an instance of the class we want to create
            clsCustomers ACustomer = new clsCustomers();
            //create some test data to assign to the property
            DateTime TestData = DateTime.Now.Date;

            //assign the data to the property
            ACustomer.DateAdded = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(ACustomer.DateAdded, TestData);
        }
예제 #23
0
        public void lastNameMinLessOne()
        {
            clsCustomers ACustomer = new clsCustomers();

            String Error = "";

            string lastName = "";

            Error = ACustomer.Valid(firstName, lastName, email, createDate);

            Assert.AreNotEqual(Error, "");
        }
예제 #24
0
        public void emailMaxPlusOne()
        {
            clsCustomers ACustomer = new clsCustomers();

            String Error = "";

            string email = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

            Error = ACustomer.Valid(firstName, lastName, email, createDate);

            Assert.AreNotEqual(Error, "");
        }
예제 #25
0
        public void CustomerEmailCustomerOK()
        {
            //Create an instance of the class we want to create
            clsCustomers ACustomer = new clsCustomers();

            //Create some test data to assign to the property
            String TestData = "*****@*****.**";

            //Assign the data to the property
            ACustomer.CustomerEmail = TestData;

            //Test to see that the two values are the same
            Assert.AreEqual(ACustomer.CustomerEmail, TestData);
        }
예제 #26
0
        public void TestCustomerNumFound()
        {
            clsCustomers ACustomer   = new clsCustomers();
            Boolean      Found       = false;
            Boolean      OK          = true;
            Int32        CustomerNum = 1;

            Found = ACustomer.Find(CustomerNum);
            if (ACustomer.customer_id != 1)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
예제 #27
0
        public void emailExtremeMax()
        {
            clsCustomers ACustomer = new clsCustomers();

            String Error = "";

            string email = "";

            email = email.PadRight(500, 'a');

            Error = ACustomer.Valid(firstName, lastName, email, createDate);

            Assert.AreNotEqual(Error, "");
        }
예제 #28
0
        public void LivesInUKCustomerOK()
        {
            //Create an instance of the class we want to create
            clsCustomers ACustomer = new clsCustomers();

            //Create some test data to assign to the property
            Boolean TestData = true;

            //Assign the data to the property
            ACustomer.LivesInUK = TestData;

            //Test to see that the two values are the same
            Assert.AreEqual(ACustomer.LivesInUK, TestData);
        }
예제 #29
0
        public void PasswordCustomerOK()
        {
            //Create an instance of the class we want to create
            clsCustomers ACustomer = new clsCustomers();

            //Create some test data to assign to the property
            String TestData = "Fatimah123";

            //Assign the data to the property
            ACustomer.Password = TestData;

            //Test to see that the two values are the same
            Assert.AreEqual(ACustomer.Password, TestData);
        }
예제 #30
0
        public void CustomerAddressCustomerOK()
        {
            //Create an instance of the class we want to create
            clsCustomers ACustomer = new clsCustomers();

            //Create some test data to assign to the property
            String TestData = "123 Green Street LE7 8HU";

            //Assign the data to the property
            ACustomer.CustomerAddress = TestData;

            //Test to see that the two values are the same
            Assert.AreEqual(ACustomer.CustomerAddress, TestData);
        }