Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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));
        }