public void Returns_Empty_Results_When_Given_Empty_List() { var ageComparer = new AgeComparer(new List<Person>()); var result = ageComparer.FindClosest(); Assert.Null(result.Person1); Assert.Null(result.Person2); }
public void Returns_Empty_Results_When_Given_One_Person() { var list = new List<Person>() { person01_Oldest }; var ageComparer = new AgeComparer(list); var result = ageComparer.FindClosest(); Assert.Null(result.Person1); Assert.Null(result.Person2); }
public void Returns_Closest_Two_For_Two_People() { var list = new List<Person>() { person01_Oldest, person02_2ndOldest }; var ageComparer = new AgeComparer(list); var result = ageComparer.FindClosest(); Assert.Same(person01_Oldest, result.Person1); Assert.Same(person02_2ndOldest, result.Person2); }
public void FindThrowsNullReferenceException_WhenEmptyList() { List<Person> list = new List<Person>(new Person[2]); AgeComparer ageComparer = new AgeComparer(list); Assert.Throws<NullReferenceException>(() => ageComparer.FindClosest()); }