Example #1
0
        public void ReportByEMailMethodOK()
        {
            clsCustomerCollection AllCustomers      = new clsCustomerCollection();
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();

            FilteredCustomers.ReportByEMail("");
            Assert.AreEqual(AllCustomers.Count, FilteredCustomers.Count);
        }
Example #2
0
        public void ReportByEMailNoneFound()
        {
            clsCustomerCollection AllCustomers      = new clsCustomerCollection();
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();

            FilteredCustomers.ReportByEMail("xxxxxxxxxxxx");
            Assert.AreEqual(0, FilteredCustomers.Count);
        }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        //Runs when Search is pressed, searches customers for emails that match search critera and populates listbox with these customers
        string Search = txtFilter.Text;
        clsCustomerCollection Customers = new clsCustomerCollection();

        Customers.ReportByEMail(Search);
        lstCustomers.Items.Clear();
        lstCustomers.DataSource     = Customers.CustomerList;
        lstCustomers.DataValueField = "CustomerNo";
        lstCustomers.DataTextField  = "EMail";
        lstCustomers.DataBind();
    }
Example #4
0
        public void ReportByEMailTestDataFound()
        {
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
            Boolean OK = true;

            FilteredCustomers.ReportByEMail("*****@*****.**");
            if (FilteredCustomers.Count == 2)
            {
                if (FilteredCustomers.CustomerList[0].CustomerNo != 32)
                {
                    OK = false;
                }
                if (FilteredCustomers.CustomerList[1].CustomerNo != 33)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }

            Assert.IsTrue(OK);
        }