public void ReportByFirstNameTestDataFound()
        {
            //create an instance of the class containing unfiltered results
            clsCustomerCollection FilteredCustomer = new clsCustomerCollection();
            //var to store outcome
            Boolean OK = true;

            //apply first name that doesn't exist
            FilteredCustomer.ReportByFirstName("Roshni");
            //check that the correct number of records are found
            if (FilteredCustomer.Count == 2)
            {
                //checked the first records is ID 7
                if (FilteredCustomer.CustomerList[0].CustomerID != 7)
                {
                    OK = false;
                }

                //check that the first records is ID 10
                if (FilteredCustomer.CustomerList[1].CustomerID != 10)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no records
            Assert.IsTrue(OK);
        }
        public void ReportByFirstNameNoneFound()
        {
            //create an instance of the class containing unfiltered results
            clsCustomerCollection FilteredCustomer = new clsCustomerCollection();

            //apply first name that doesn't exist
            FilteredCustomer.ReportByFirstName("N Faquir");
            //test to see that the two values are the same
            Assert.AreEqual(0, FilteredCustomer.Count);
        }
        public void ReportByFirstNameMethodOK()
        {
            //create an instance of the class containing unfiltered results
            clsCustomerCollection AllCustomer = new clsCustomerCollection();
            //create an instance of the filtered data
            clsCustomerCollection FilteredCollection = new clsCustomerCollection();

            //apply a blank string (should return all records);
            FilteredCollection.ReportByFirstName("");
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomer.Count, FilteredCollection.Count);
        }
Beispiel #4
0
    protected void txtApply_Click(object sender, EventArgs e)
    {
        //create an instance of the customer collection
        clsCustomerCollection Customer = new clsCustomerCollection();

        Customer.ReportByFirstName(txtFirstName.Text);
        lstCustomerList.DataSource = Customer.CustomerList;
        //set the name of the primarykey
        lstCustomerList.DataValueField = "CustomerID";
        //set the name of the field to display
        lstCustomerList.DataTextField = "Firstname";
        //bind the data to the list
        lstCustomerList.DataBind();
    }
Beispiel #5
0
    protected void txtClear_Click(object sender, EventArgs e)
    {
        //create an instance of the customer collection
        clsCustomerCollection Customer = new clsCustomerCollection();

        Customer.ReportByFirstName("");
        //clear any existing filter to tidy up the interface
        txtFirstName.Text          = "";
        lstCustomerList.DataSource = Customer.CustomerList;
        //set the name of the primarykey
        lstCustomerList.DataValueField = "CustomerID";
        //set the name of the field to display
        lstCustomerList.DataTextField = "Firstname";
        //bind the data to the list
        lstCustomerList.DataBind();
    }