Exemple #1
0
        private static void SortByGenderAndLastNameAscending(ISortService sortService, IList <Person> unsortedList)
        {
            IList <Person> sortedByGender = sortService.SortByGenderAndLastNameAscending(unsortedList);

            Console.WriteLine(" ");
            Console.WriteLine("Sorted by gender and by last name ascending.");
            PrintList(sortedByGender);
        }
Exemple #2
0
        public override IList <Person> GetGersons(IList <Person> unsortedList, string sortBy)
        {
            IList <Person> persons = new List <Person>();

            if (sortBy.Contains(DBWebAPI.Model.Constants.Gender))
            {
                persons = _sortService.SortByGenderAndLastNameAscending(unsortedList);
            }
            return(persons);
        }
Exemple #3
0
        public void SortServiceShouldSortByGenderAndLastNameAscending()
        {
            //arrange
            List <Person> unsortedList = GetUnsortedPersonList();

            //act
            IList <Person> sortedList = _sortService.SortByGenderAndLastNameAscending(unsortedList);

            var first = sortedList.FirstOrDefault();
            var last  = sortedList.LastOrDefault();

            //assert
            Assert.AreEqual("Connichie", first.LastName);
            Assert.AreEqual("Whiteside", last.LastName);
        }