コード例 #1
0
        public async void ListOwner_SortGetGenderKeys_True()
        {
            // Arrange
            // See Constructor/Setup above

            IEnumerable <Owner> listOwner = await _ownerRepository.GetAll();

            ILinqSorterOwner linqSorter = new LinqSorterOwner();

            // Act
            var listSorted = linqSorter.SortGroupByGender(listOwner).ToList();

            // Assert
            Assert.Equal(2, listSorted.Count);
            Assert.Equal("Female", listSorted[0].Key);
            Assert.Equal("Male", listSorted[1].Key);
        }
コード例 #2
0
        public async void ListOwnerSort_SortByGenderFemaleAliceFirst_True()
        {
            // Arrange
            // See Constructor/Setup above

            IList <Owner> listOwner = await _ownerRepository.GetAll();

            ILinqSorterOwner linqSorter = new LinqSorterOwner();

            // Act
            var listSorted = linqSorter.SortGroupByGender(listOwner).ToList();

            // Assert
            var female      = listSorted[0];
            var femaleFirst = female.First();

            Assert.Equal("Alice", femaleFirst.Name);
        }
コード例 #3
0
        public async void ListOwnerSort_SortByGenderMalesInOrder_True()
        {
            // Arrange
            // See Constructor/Setup above

            IList <Owner> listOwner = await _ownerRepository.GetAll();

            ILinqSorterOwner linqSorter = new LinqSorterOwner();

            // Act
            var listSorted = linqSorter.SortGroupByGender(listOwner).ToList();

            // Assert
            var male       = listSorted[1];
            var maleFirst  = male.First();
            var maleSecond = male.Skip(1).First();

            Assert.Equal("Bob", maleFirst.Name);
            Assert.Equal("Fred", maleSecond.Name);
        }
コード例 #4
0
        public async void ListOwnerSort_SortByGenderFemalesInOrder_True()
        {
            // Arrange
            // See Constructor/Setup above

            IList <Owner> listOwner = await _ownerRepository.GetAll();

            ILinqSorterOwner linqSorter = new LinqSorterOwner();

            // Act
            var listSorted = linqSorter.SortGroupByGender(listOwner).ToList();

            // Assert
            var female       = listSorted[0];
            var femaleFirst  = female.First();
            var femaleSecond = female.Skip(1).First();
            var femaleThird  = female.Skip(2).First();

            Assert.Equal("Alice", femaleFirst.Name);
            Assert.Equal("Jennifer", femaleSecond.Name);
            Assert.Equal("Samantha", femaleThird.Name);
        }