Unit test a method that sorts a collection
问题 I have a method that sorts a collection based on a property like this: public List<Student> GetAllStudents() { return _studentCatalogContext.Student.Where(x => (x.Course != 2 && x.Course != 6)) .OrderByDescending(x => x.EnrollDateTime).ToList(); } So the idea is to have, in this case, the most recently enrolled Student first. Since the result of the method call will be a sorted list with the newest enrollment first I wrote a test like this: [TestMethod] public void Calling_GetAllStudents