public void FilterbyeMailTestDataFound()
        {
            //create an instance of the filtered data
            clsReviewsCollection FilteredReviews = new clsReviewsCollection("");
            //var to store outcome
            Boolean OK = true;

            //apply a primary key value
            FilteredReviews.FilterbyEmail("*****@*****.**");
            //check the correct number of records are found
            if (FilteredReviews.Count == 12)
            {
                //check the first record is ID 2
                if (FilteredReviews.ReviewList[0].ReviewId != 2000)
                {
                    OK = false;
                }
                // check that the first record is ID
                if (FilteredReviews.ReviewList[11].ReviewId != 2016)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }

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

            //apply a blank string (should return all records)
            FilteredReviews.FilterbyEmail("xxx xxx");
            //test to see the two values are the same
            Assert.AreEqual(0, FilteredReviews.Count);
        }
        public void FilterbyEmailOK()
        {
            clsReviews TestItem = new clsReviews();
            //create an instance of the class we want to create
            clsReviewsCollection AllReviews = new clsReviewsCollection();
            //create an instance of the filtered data
            clsReviewsCollection FilteredReviews = new clsReviewsCollection("");

            //apply a blank string (should return all records)
            FilteredReviews.FilterbyEmail("");
            //test to see the two values are the same
            Assert.AreEqual(AllReviews.Count, FilteredReviews.Count);
        }
Exemple #4
0
    void FilterEmail(string Email)
    {
        //create an instance of the booking collection
        clsReviewsCollection Review = new clsReviewsCollection();

        Review.FilterbyEmail(Email);
        //set the data source to the list of bookings in the collection
        lstReviews.DataSource = Review.ReviewList;
        //set the name of the primary key
        lstReviews.DataValueField = "ReviewId";
        //set the data field to display
        lstReviews.DataTextField = "Email";
        //bind the data to the list
        lstReviews.DataBind();
    }