Exemple #1
0
        public void Build_SortsByAgeRange()
        {
            var ranger  = new TestAgeRanger();
            var builder = new PeopleListBuilder(ranger);
            var list    = GetList();
            var people  = builder.Build(list, 0, 20, 3, "asc", string.Empty);

            Assert.AreEqual(20, people.Count, "list contains 20 items");
            Assert.AreEqual("Lizzette", people[0].FirstName, "should sort by column 2");
        }
Exemple #2
0
        public void Build_SortsByLastName()
        {
            var ranger  = new TestAgeRanger();
            var builder = new PeopleListBuilder(ranger);
            var list    = GetList();
            var people  = builder.Build(list, 0, 20, 2, "asc", string.Empty);

            Assert.AreEqual(20, people.Count, "list contains 20 items");
            Assert.AreEqual("Bonds", people[0].LastName, "should sort by last name");
        }
Exemple #3
0
        public void Build_SortsByLastNameWithNulls()
        {
            var ranger  = new TestAgeRanger();
            var builder = new PeopleListBuilder(ranger);
            var list    = GetListWithItemsContainingNulls();
            var people  = builder.Build(list, 0, 22, 2, "asc", string.Empty);

            Assert.AreEqual(22, people.Count, "list contains 22 items");
            Assert.AreEqual(100, people[0].Id, "should sort by last name");
        }
Exemple #4
0
        public void Build_SortsByNameDescending()
        {
            var ranger  = new TestAgeRanger();
            var builder = new PeopleListBuilder(ranger);
            var list    = GetList();
            var people  = builder.Build(list, 0, 20, 1, "desc", string.Empty);

            Assert.AreEqual(20, people.Count, "list contains 20 items");
            Assert.AreEqual("Temple", people[0].FirstName, "should sort by name");
        }
Exemple #5
0
        public void Build_SearchByFirstAndLastNameWithNulls()
        {
            var ranger  = new TestAgeRanger();
            var builder = new PeopleListBuilder(ranger);
            var list    = GetListWithItemsContainingNulls();
            var people  = builder.Build(list, 0, 20, 0, "asc", "AN");

            Assert.AreEqual(5, people.Count, "list contains 5 items");
            Assert.AreEqual(7, people[0].Id, "should filter output");
        }
Exemple #6
0
        public void Build_SkipsAndTakesNRecords()
        {
            var ranger  = new TestAgeRanger();
            var builder = new PeopleListBuilder(ranger);
            var list    = GetList();
            var people  = builder.Build(list, 10, 5, 0, "asc", string.Empty);

            Assert.AreEqual(5, people.Count, "list contains 5 items");
            Assert.AreEqual("Beth", people[0].FirstName, "should sort by column 2");
        }
Exemple #7
0
        public void Build_TakesAllRecords()
        {
            var ranger  = new TestAgeRanger();
            var builder = new PeopleListBuilder(ranger);
            var list    = GetList();
            var people  = builder.Build(list, 0, -1, 0, "asc", string.Empty);

            Assert.AreEqual(20, people.Count, "list contains All items");
            Assert.AreEqual("Scottie", people[0].FirstName, "should sort by column 2");
        }
Exemple #8
0
        public void Build_UnsortedList()
        {
            var ranger  = new TestAgeRanger();
            var builder = new PeopleListBuilder(ranger);
            var list    = GetList();
            var people  = builder.Build(list, 0, 20, 0, "desc", string.Empty);

            Assert.AreEqual(20, people.Count, "list contains 20 items");
            Assert.AreEqual("Scottie", people[0].FirstName, "should sort by clumn 0");
        }