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

            //apply a username that doesnt exist
            FilteredCustomers.ReportByUsername("TestUser");
            //check that the correct number of records are found
            if (FilteredCustomers.Count == 2)
            {
                //check that the first record is ID 8
                if (FilteredCustomers.CustomerList[0].CustomerId != 8)
                {
                    OK = false;
                }
                //check that the Second record is ID 32
                if (FilteredCustomers.CustomerList[1].CustomerId != 32)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no records
            Assert.IsTrue(OK);
        }
Example #2
0
        public void ReportByUsernameNoneFound()
        {
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();

            FilteredCustomers.ReportByUsername("Example123");
            Assert.AreEqual(0, FilteredCustomers.Count);
        }
Example #3
0
        public void ReportByUsernameMethodOK()
        {
            clsCustomerCollection AllCustomers      = new clsCustomerCollection();
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();

            FilteredCustomers.ReportByUsername("");
            Assert.AreEqual(AllCustomers.Count, FilteredCustomers.Count);
        }
        public void ReportByUsernameNoneFound()
        {
            clsCustomerCollection AllCustomers      = new clsCustomerCollection();
            clsCustomerCollection FilteredUsernames = new clsCustomerCollection();

            FilteredUsernames.ReportByUsername("__");
            Assert.AreEqual(0, FilteredUsernames.Count);
        }
Example #5
0
    protected void btnApply_Click1(object sender, EventArgs e)
    {
        clsCustomerCollection Customers = new clsCustomerCollection();

        Customers.ReportByUsername(txtFilter.Text);
        lstCustomersList.DataSource     = Customers.CustomerList;
        lstCustomersList.DataValueField = "CustomerId";
        lstCustomersList.DataTextField  = "Username";
        lstCustomersList.DataBind();
    }
Example #6
0
        public void ReportByUsernameNoneFound()
        {
            //create an instance of the filtered data
            clsCustomerCollection FilteredUsernames = new clsCustomerCollection();

            //apply a username that doesnt exsit
            FilteredUsernames.ReportByUsername("xxxx");
            //test to see that there are no records
            Assert.AreEqual(0, FilteredUsernames.Count);
        }
Example #7
0
        public void ReportByUsernameOK()
        {
            //create an instance of the class containing unfiltered results
            clsCustomerCollection AllCustomers = new clsCustomerCollection();
            //create an instance of the filtered data
            clsCustomerCollection FilteredUsernames = new clsCustomerCollection();

            //apply a blank string (should return all records);
            FilteredUsernames.ReportByUsername("");
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomers.Count, FilteredUsernames.Count);
        }
Example #8
0
    protected void btnApply_Click(object sender, EventArgs e)
    {
        //create an instance of the customer collection
        clsCustomerCollection Customers = new clsCustomerCollection();

        Customers.ReportByUsername(txtFilter.Text);
        lstCustomerList.DataSource = Customers.CustomerList;
        //set the name of the primary key
        lstCustomerList.DataValueField = "CustomerId";
        //set the name of the field to display
        lstCustomerList.DataTextField = "Username";
        //bind the data to the list
        lstCustomerList.DataBind();
    }
Example #9
0
 protected void btnClear_Click(object sender, EventArgs e)
 {
     //create an instance of the customer collection 
     clsCustomerCollection Customers = new clsCustomerCollection();
     Customers.ReportByUsername("");
     //clear any existing filter to tidy up the interface
     txtUsernameFilter.Text = "";
     lstCustomerList.DataSource = Customers.CustomerList;
     //set the name of the primary key 
     lstCustomerList.DataValueField = "CustomerId";
     //set the name of the field to display
     lstCustomerList.DataTextField = "Username";
     //bind the data to the list
     lstCustomerList.DataBind();
 }
Example #10
0
        public void ReportByUsernameTestDataFound()
        {
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
            Boolean OK = true;

            FilteredCustomers.ReportByUsername("Example123");
            if (FilteredCustomers.Count == 2)
            {
                if (FilteredCustomers.CustomerList[0].CustomerID != 1)
                {
                    OK = false;
                }
                if (FilteredCustomers.CustomerList[1].CustomerID != 2)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }