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

            //apply a primary key value
            FilteredCustomers.FilterbysurName("yyyyyy");
            //check the correct number of records are found
            if (FilteredCustomers.Count == 2)
            {
                //check the first record is ID 2
                if (FilteredCustomers.CustomerList[0].CustomerID != 46)
                {
                    OK = false;
                }
                // check that the first record is ID
                if (FilteredCustomers.CustomerList[1].CustomerID != 73)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }

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

            //apply a blank string (should return all records)
            FilteredCustomers.FilterbysurName("xxx xxx");
            //test to see the two values are the same
            Assert.AreEqual(0, FilteredCustomers.Count);
        }
        public void FilterbysurNameMethodOK()
        {
            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.FilterbysurName("");
            //test to see the two values are the same
            Assert.AreEqual(AllCustomer.Count, FilteredCustomers.Count);
        }
Beispiel #4
0
    void FilterSnameadmin(string sname)
    {
        //create an instance of the booking collection
        clsCustomerCollection C = new clsCustomerCollection(" ");

        C.FilterbysurName(sname);
        //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 = "CustomerID";
        //set the data field to display
        lstCust.DataTextField = "surName";
        //bind the data to the list
        lstCust.DataBind();
    }
        Int32 FilterSurname(string Surname)
        {
            //create an instance of the booking collection
            clsCustomerCollection C = new clsCustomerCollection();

            C.FilterbysurName(Surname);
            //set the data source to the list of bookings in the collection
            lstCust.DataSource = C.CustomerList;
            //set the name of the primary key
            lstCust.ValueMember = "CustomerID";
            //set the data field to display
            lstCust.DisplayMember = "Surname";
            //bind the data to the list
            return(C.Count);
        }