Esempio n. 1
0
        public void SortByGender()
        {
            // Arrange
            var originalList = db.Get();
            var sortedList   = originalList.OrderBy(r => r.Gender).ThenBy(r => r.LastName).ToList();

            // Act
            var testList = controller.SortByGender().ToList();
            var passTest = true;

            for (int i = 0; i < testList.Count() - 1 && passTest; i++)
            {
                passTest &= (testList[i].Gender.CompareTo(testList[i + 1].Gender)) <= 0;
            }

            // Assert
            Assert.IsTrue(passTest);
        }