I want to write a lambda expression to verify that a list is ordered correctly. I have a List where a person has a Name property eg:
IList<Person> people = new List<Person>();
people.Add(new Person(){ Name = "Alan"});
people.Add(new Person(){ Name = "Bob"});
people.Add(new Person(){ Name = "Chris"});
I'm trying to test that the list is ordered ASC by the Name property.So I'm after something like
Assert.That(people.All(....), "list of person not ordered correctly");
How can I write a lambda to check that each Person in the list has a name less that the next person in the list?