Ejemplo n.º 1
0
        public void Process(string filePath)
        {
            var nameList = fileReader.ReadLines(filePath);

            personNameCollection.AddList(nameList);
            personNameCollection.Sort();

            fileWriter.WriteLines("./sorted-names-list.txt", personNameCollection.PersonNames.Select(x => x.FullName).ToList());

            foreach (var personName in personNameCollection.PersonNames)
            {
                Console.WriteLine(personName.FullName);
            }
        }
Ejemplo n.º 2
0
        public void SortCollection()
        {
            //Arrange
            var nameList = new List <string>(new[]
                                             { "Janet Parsons", "Vaughn Lewis", "Adonis Julius Archer" });
            var orderedNameList = new List <string>(new[]
                                                    { "Adonis Julius Archer", "Vaughn Lewis", "Janet Parsons" });

            //Act
            personNameCollection.AddList(nameList);
            personNameCollection.Sort();

            //Assert
            Assert.IsTrue(personNameCollection.PersonNames.Select(x => x.FullName).SequenceEqual(orderedNameList));
        }