Example #1
0
        public void SortByBirthdate()
        {
            // Arrange
            var originalList = db.Get();
            var sortedList   = originalList.OrderBy(r => r.DateOfBirth).ToList();

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

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

            // Assert
            Assert.IsTrue(passTest);
        }