Exemplo n.º 1
0
        public void ReportByCustomerLastNameTestDataFound()
        {
            //create an instance of the filtered data
            clsCustomerCollection FilteredCustomer = new clsCustomerCollection();
            //var to store outcome
            Boolean OK = true;

            //apply a post code that doesn't exist
            FilteredCustomer.ReportByLastName("Slong");
            //check that the correct number of records are found
            if (FilteredCustomer.Count == 2)
            {
                //check that the first record is ID 36
                if (FilteredCustomer.CustomerList[0].customerID != 93)
                {
                    OK = false;
                }
                //check that the first record is ID 37
                if (FilteredCustomer.CustomerList[1].customerID != 94)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no records
            Assert.IsTrue(OK);
        }
Exemplo n.º 2
0
        public void ReportByLastNameNoneFound()
        {
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();

            FilteredCustomers.ReportByLastName("asdasdasdqweqw");
            Assert.AreEqual(0, FilteredCustomers.Count);
        }
Exemplo n.º 3
0
 public void ReportByLastNameTestDataFound()
 {
     //create an instance of the filtered data
     clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
     //var to store outcome
     Boolean OK = true;
     //apply a last name that doesnt exist
     FilteredCustomers.ReportByLastName("Grass");
     //check that the correct number of records are found
     if (FilteredCustomers.Count == 2)
     {
         //check that the first record is ID 5
         if (FilteredCustomers.CustomerList[0].CustomerNo != 5)
         {
             OK = false;
         }
         //check that the first record is ID 3
         if (FilteredCustomers.CustomerList[1].CustomerNo != 2043)
         {
             OK = false;
         }                
     }
     else
     {
         OK = false;
     }
     //test to see that there are no records
     Assert.IsTrue(OK);
 }
Exemplo n.º 4
0
        public void ReportByLastNameMethodOK()
        {
            clsCustomerCollection AllCustomers      = new clsCustomerCollection();
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();

            FilteredCustomers.ReportByLastName("");
            Assert.AreEqual(AllCustomers.Count, FilteredCustomers.Count);
        }
Exemplo n.º 5
0
 public void ReportByLastNameNoneFound()
 {
     //create an instance of the filtered data
     clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
     //apply a blank string 
     FilteredCustomers.ReportByLastName("xxxxxxxx");
     //test to see that the two values are the same
     Assert.AreEqual(0, FilteredCustomers.Count);
 }
Exemplo n.º 6
0
        public void ReportByFirstNameNoneFound()
        {
            //create an instance of the filtered data
            clsCustomerCollection FilteredCustomer = new clsCustomerCollection();

            FilteredCustomer.ReportByLastName("xxxxxx");
            //test to see that there are no recors
            Assert.AreEqual(0, FilteredCustomer.Count);
        }
Exemplo n.º 7
0
    protected void btnApply_Click(object sender, EventArgs e)
    {
        clsCustomerCollection Customers = new clsCustomerCollection();

        Customers.ReportByLastName(txtEnter.Text);
        lstCustomerList.DataSource     = Customers.CustomerList;
        lstCustomerList.DataValueField = "CustomerID";
        lstCustomerList.DataTextField  = "LastName";
        lstCustomerList.DataBind();
    }
Exemplo n.º 8
0
 public void ReportByLastNameMethodOK()
 {
     //create an instance of the class containing unfiltered results
     clsCustomerCollection AllCustomers = new clsCustomerCollection();
     //create an instance of the filtered data
     clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
     //apply a blank string 
     FilteredCustomers.ReportByLastName("");
     //test to see that the two values are the same
     Assert.AreEqual(AllCustomers.Count, FilteredCustomers.Count);
 }
    protected void btnApply_Click(object sender, EventArgs e)
    {
        //create an instance of the customer collection
        clsCustomerCollection Customer = new clsCustomerCollection();

        Customer.ReportByLastName(txtFilter.Text);
        lstCustomerList.DataSource = Customer.CustomerList;
        //set the name of the primary key
        lstCustomerList.DataValueField = "CustomerID";
        //set the name of the field of siplay
        lstCustomerList.DataTextField = "CustomerLastName";
        //bind the data to the list
        lstCustomerList.DataBind();
    }
    protected void btnClear_Click(object sender, EventArgs e)
    {
        //create an instance of the customer collection
        clsCustomerCollection Customer = new clsCustomerCollection();

        Customer.ReportByLastName("");
        //clear any extinng filter to tidy up the interface
        txtFilter.Text             = "";
        lstCustomerList.DataSource = Customer.CustomerList;
        //set the name of the primary key
        lstCustomerList.DataValueField = "CustomerID";
        //set the name of the field of display
        lstCustomerList.DataTextField = "CustomerFirstName";
        //bind the data to the list
        lstCustomerList.DataBind();
    }
Exemplo n.º 11
0
        public void ReportByLastNameTestDataFound()
        {
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
            Boolean OK = true;

            FilteredCustomers.ReportByLastName("asdzxczxzxqw");
            if (FilteredCustomers.Count == 2)
            {
                if (FilteredCustomers.CustomerList[0].CustomerID != 36)
                {
                    OK = false;
                }
                if (FilteredCustomers.CustomerList[0].CustomerID != 37)
                {
                    OK = false;
                }
                else
                {
                    OK = false;
                }
            }
            Assert.IsTrue(OK);
        }
Exemplo n.º 12
0
    Int32 DisplayCustomers(string LastNameFilter)
    {
        Int32  CustomerNo;                                             //var to store the primary key
        String ForeName;                                               //var to store the first name
        String LastName;                                               //var to store the last name
        clsCustomerCollection Customers = new clsCustomerCollection(); //create an instance of the customer collection class

        Customers.ReportByLastName(LastNameFilter);
        Int32 RecordCount;                                                                      //var to store the count of records
        Int32 Index = 0;                                                                        //var to store the index for the loop

        RecordCount = Customers.Count;                                                          //get the count of records
        lstCustomers.Items.Clear();                                                             //clear the list box
        while (Index < RecordCount)                                                             //while there are records to process
        {
            CustomerNo = Customers.CustomerList[Index].CustomerNo;                              //get the primary key
            ForeName   = Customers.CustomerList[Index].ForeName;                                //get the first name
            LastName   = Customers.CustomerList[Index].LastName;                                //get the last name
            ListItem NewEntry = new ListItem(ForeName + " " + LastName, CustomerNo.ToString()); //create a new entry for the list box
            lstCustomers.Items.Add(NewEntry);                                                   //add the customer to the list
            Index++;                                                                            //move the index to the next record
        }
        return(RecordCount);                                                                    //return the count of records found
    }