Пример #1
0
        public void ReportByNameTestDataFound()
        {
            //create an instance of the filtered data
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
            //var to store outcome
            Boolean OK = true;

            //apply a name that doesnt exist
            FilteredCustomers.ReportByName("Thomas");
            //check that the correct number of records are found
            if (FilteredCustomers.Count == 2)
            {
                //check the first record id is 22
                if (FilteredCustomers.CustomerList[0].CustomerId != 22)
                {
                    OK = false;
                }
                //check that the second record is id 23
                if (FilteredCustomers.CustomerList[1].CustomerId != 23)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no records
            Assert.IsTrue(OK);
        }
Пример #2
0
        public void ReportByNameNoneFound()
        {
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();

            FilteredCustomers.ReportByName("Alyx Vance");
            Assert.AreEqual(0, FilteredCustomers.Count);
        }
Пример #3
0
        public void ReportByNameTestDataFound()
        {
            //create an instance of the filtered data
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
            //var to store outcome
            Boolean OK = true;

            //apply a name that does not exist
            FilteredCustomers.ReportByName("Gabriel");
            //check that the correct number of records are found
            if (FilteredCustomers.Count == 2)
            {
                //Check that the first record is ID 46
                if (FilteredCustomers.CustomerList[0].CustomerID != 46)
                {
                    OK = false;
                }
                //Check that the first record is ID 48
                if (FilteredCustomers.CustomerList[1].CustomerID != 48)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no record
            Assert.IsTrue(OK);
        }
        public void ReportByNameDataFound()
        {
            //create an instance of the filtered data
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
            //var to store outcome
            Boolean OK = true;

            //apply a name that doesnt exist
            FilteredCustomers.ReportByName("Nasreen Shaikh");
            //check the correct number of records are found
            if (FilteredCustomers.Count == 2)
            {
                //check that the first record is ID 30/33
                if (FilteredCustomers.CustomerList[0].Id != 31)
                {
                    OK = false;
                }
                //check that the first record is ID 33
                if (FilteredCustomers.CustomerList[1].Id != 37)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see if there are no records
            Assert.IsTrue(OK);
        }
Пример #5
0
        public void ReportByNameTestDataFound()
        {
            //create an instance of the filtered data
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
            //var to store outcome
            Boolean OK = true;

            //apply a name that doesn't exist
            FilteredCustomers.ReportByName("test");
            //check that the correct number of records are found
            if (FilteredCustomers.Count == 2)
            {
                //check that the first ID is 12 (TO BE DECIDED)
                if (FilteredCustomers.CustomerList[0].CustomerNo != 5)
                {
                    OK = false;
                }
                if (FilteredCustomers.CustomerList[1].CustomerNo != 6)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no records
            Assert.IsTrue(OK);
        }
        public void ReportByNameMethodNoneFound()
        {
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();

            FilteredCustomers.ReportByName("Cthulu");
            Assert.AreEqual(0, FilteredCustomers.Count);
        }
Пример #7
0
        public void ReportByNameMethodOK()
        {
            clsCustomerCollection AllCustomers      = new clsCustomerCollection();
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();

            FilteredCustomers.ReportByName("");
            Assert.AreEqual(AllCustomers.Count, FilteredCustomers.Count);
        }
Пример #8
0
        public void ReportByNameNoneFound()
        {
            //create an instance of the classes we want to create
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();

            //non existing data created to see if it finds it
            FilteredCustomers.ReportByName("xxxxx xxxxx");
            //test to see that it passes
            Assert.AreEqual(0, FilteredCustomers.Count);
        }
Пример #9
0
        public void ReportByNameMethodOK()
        {
            //create an instance of the classes we want to create
            clsCustomerCollection AllCustomers      = new clsCustomerCollection();
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();

            FilteredCustomers.ReportByName("");
            //test to see that it passes
            Assert.AreEqual(AllCustomers.Count, FilteredCustomers.Count);
        }
Пример #10
0
    protected void btnApply_Click(object sender, EventArgs e)
    {
        clsCustomerCollection Customers = new clsCustomerCollection();

        Customers.ReportByName(txtFilter.Text);
        lstCustomerList.DataSource     = Customers.CustomerList;
        lstCustomerList.DataValueField = "CustomerId";
        lstCustomerList.DataTextField  = "CustomerName";
        lstCustomerList.DataBind();
    }
Пример #11
0
        public void ReportByNameNoneFound()
        {
            //create an instance of the filtered data
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();

            //apply a name that doesnt exist
            FilteredCustomers.ReportByName("XXXXX");
            //test to see that there are no records
            Assert.AreEqual(0, FilteredCustomers.Count);
        }
Пример #12
0
    protected void btnClear_Click(object sender, EventArgs e)
    {
        clsCustomerCollection Customers = new clsCustomerCollection();

        Customers.ReportByName("");
        txtEnterName.Text              = "";
        lstCustomerList.DataSource     = Customers.CustomerList;
        lstCustomerList.DataValueField = "CustomerId";
        lstCustomerList.DataTextField  = "Name";
        lstCustomerList.DataBind();
    }
Пример #13
0
        public void ReportByNameMethod()
        {
            //create and 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 (should return all records)
            FilteredCustomers.ReportByName("");
            //test to see that the two values are the same
            Assert.AreEqual(AllCustomers.Count, FilteredCustomers.Count);
        }
Пример #14
0
    protected void btnApply_Click(object sender, EventArgs e)
    {
        //create an instance of the customer collection
        clsCustomerCollection Customers = new clsCustomerCollection();

        Customers.ReportByName(txtFilter.Text);
        lstCustomerList.DataSource = Customers.CustomerList;
        //set the name of the primary key
        lstCustomerList.DataValueField = "CustomerNo";
        //set the name of field to display
        lstCustomerList.DataTextField = "Name";
        //bind the data to the list
        lstCustomerList.DataBind();
    }
Пример #15
0
    protected void btnApply_Click(object sender, EventArgs e)
    {
        //create new instance
        clsCustomerCollection Customers = new clsCustomerCollection();

        //applies the filtered attribute entered
        Customers.ReportByName(txtName.Text);
        //set data source to customer list
        lstCustomerList.DataSource = Customers.CustomerList;
        //Select the primary key from list
        lstCustomerList.DataValueField = "customerId";
        //set name field to display
        lstCustomerList.DataTextField = "customerName";
        //bind data to the list
        lstCustomerList.DataBind();
    }
Пример #16
0
    protected void btnClear_Click(object sender, EventArgs e)
    {
        //create an instance of the customer collection
        clsCustomerCollection Customers = new clsCustomerCollection();

        Customers.ReportByName("");
        //clear any existing filter to tidy up the interface
        txtEnterName.Text          = "";
        lstCustomerList.DataSource = Customers.CustomerList;
        //set the name of the primary key
        lstCustomerList.DataValueField = "Id";
        //set the data field to display
        lstCustomerList.DataTextField = "Name";
        //bind the data to the list
        lstCustomerList.DataBind();
    }
Пример #17
0
    protected void btnClear_Click(object sender, EventArgs e)
    {
        //create new instance of customer collection class
        clsCustomerCollection Customers = new clsCustomerCollection();

        Customers.ReportByName("");
        //sets the text field back to blank
        txtName.Text = "";
        //sets the data source to customer list
        lstCustomerList.DataSource = Customers.CustomerList;
        //displays primary key entries back into the list
        lstCustomerList.DataValueField = "customerId";
        //displays name field in list
        lstCustomerList.DataTextField = "customerName";
        //binds data to the list
        lstCustomerList.DataBind();
    }
Пример #18
0
        public void ReportByNameTestDataFound()
        {
            //create an instance of the classes we want to create
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
            Boolean OK = true;

            //testing when 4 of the same name entry is found
            FilteredCustomers.ReportByName("Tobias Jenkins");
            if (FilteredCustomers.Count == 4)
            {
                if (FilteredCustomers.CustomerList[0].CustomerId != 3)
                {
                    OK = false;
                }

                if (FilteredCustomers.CustomerList[1].CustomerId != 8)
                {
                    OK = false;
                }

                if (FilteredCustomers.CustomerList[2].CustomerId != 10)
                {
                    OK = false;
                }

                if (FilteredCustomers.CustomerList[3].CustomerId != 11)
                {
                    OK = false;
                }

                else
                {
                    OK = false;
                }
                //test to see that it passes
                Assert.IsTrue(OK);
            }
        }
Пример #19
0
        public void ReportByNameTestDataFound()
        {
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
            Boolean OK = true;

            FilteredCustomers.ReportByName("julia");
            if (FilteredCustomers.Count == 2)
            {
                if (FilteredCustomers.CustomerList[0].AccountNo != 1)
                {
                    OK = false;
                }
                if (FilteredCustomers.CustomerList[1].AccountNo != 2)
                {
                    OK = false;
                }
            }
            else
            {
                OK = true;
            }
            Assert.IsTrue(OK);
        }
Пример #20
0
        public void ReportByNameTestDataFound()
        {
            clsCustomerCollection FilteredCustomers = new clsCustomerCollection();
            Boolean OK = true;

            FilteredCustomers.ReportByName("Adrian Shephard");

            if (FilteredCustomers.Count == 2)
            {
                if (FilteredCustomers.CustomerList[0].CustomerId != 57)
                {
                    OK = false;
                }
                if (FilteredCustomers.CustomerList[1].CustomerId != 58)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
    Int32 DisplayCustomers(string NameFilter)
    {
        //var to store the username
        string Username;
        //var to store the name
        string Name;
        //create an instance of customer collection class
        clsCustomerCollection Customers = new clsCustomerCollection();

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

        //get the count of records
        RecordCount = Customers.Count;
        //clear the list box
        lstCustomers.Items.Clear();
        //while there are records
        while (Index < RecordCount)
        {
            //get the username
            Username = Customers.CustomerList[Index].Username;
            //get the custome name
            Name = Customers.CustomerList[Index].Name;
            //create a new entry for th list box
            ListItem NewEntry = new ListItem(Name + " " + Username.ToString());
            //add the customer to the list
            lstCustomers.Items.Add(NewEntry);
            //move the index to the next record
            Index++;
        }
        //return to the count of records found
        return(RecordCount);
    }