public void Given_List_With_OneName_Return_OneName() { var sorter = new PersonSorter(new PersonNameComparer()); var list = new List <PersonDTO>(); list.Add(new PersonDTO("one", "A")); var sortedList = sorter.Sort(list); Assert.AreEqual("A", sortedList.First().LastName); }
public void Is_List_Sorted_By_LastName() { var sorter = new PersonSorter(new PersonNameComparer()); var list = new List <PersonDTO>(); list.Add(new PersonDTO("two", "B")); list.Add(new PersonDTO("one", "A")); list.Add(new PersonDTO("four", "D")); list.Add(new PersonDTO("three", "C")); var sortedList = sorter.Sort(list); Assert.AreEqual("A", sortedList.First().LastName); }
public void SortByNameLengthAndExcludeMinAge(params string[] input) { // Arrange var reader = new Mock <IReader>(); var writer = new Mock <IWriter>(); reader.SetupSequence(r => r.ReadLine()) .Returns(input[0]) .Returns(input[1]) .Returns(input[2]) .Returns(input[3]); var sut = new PersonSorter(); // Act sut.Read(reader.Object); sut.Sort(); sut.Write(writer.Object); // Assert //writer.Verify(r => r.WriteLine, Times.Exactly(4)); }