Exemple #1
0
        public void FilterbyeMailTestDataFound()
        {
            //create an instance of the filtered data
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection(" ");
            //var to store outcome
            Boolean OK = true;

            //apply a primary key value
            FilteredCustomers.Filterbyemail("*****@*****.**");
            //check the correct number of records are found
            if (FilteredCustomers.Count == 2)
            {
                //check the first record is ID 2
                if (FilteredCustomers.CustomerList[0].Id != 2002)
                {
                    OK = false;
                }
                // check that the first record is ID
                if (FilteredCustomers.CustomerList[1].Id != 2007)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }

            //test to see there are records
            Assert.IsTrue(OK);
        }
Exemple #2
0
        public void FilterbyeMailNoneFound()
        {
            //create an instance of the filtered data
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection(" ");

            //apply a blank string (should return all records)
            FilteredCustomers.Filterbyemail("xxx xxx");
            //test to see the two values are the same
            Assert.AreEqual(0, FilteredCustomers.Count);
        }
Exemple #3
0
        public void FilterbyeMailOK()
        {
            clsCustomer TestItem = new clsCustomer();
            //create an instance of the class we want to create
            clsCustomerCollection AllCustomer = new clsCustomerCollection();
            //create an instance of the filtered data
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection("");

            //apply a blank string (should return all records)
            FilteredCustomers.Filterbyemail("");
            //test to see the two values are the same
            Assert.AreEqual(AllCustomer.Count, FilteredCustomers.Count);
        }
    void Filteremail(string email)
    {
        //create an instance of the booking collection
        clsCustomerCollection C = new clsCustomerCollection();

        C.Filterbyemail(email);
        //set the data source to the list of bookings in the collection
        lstCust.DataSource = C.CustomerList;
        //set the name of the primary key
        lstCust.DataValueField = "id";
        //set the data field to display
        lstCust.DataTextField = "email";
        //bind the data to the list
        lstCust.DataBind();
    }