Ejemplo n.º 1
0
        public void SortFullList()
        {
            List <string> outputNames   = new List <string>();
            List <string> outputAddress = new List <string>();

            TestInput.Add("Matt Brown 12 Acton St");
            TestInput.Add("Heinrich Jones 31 Clifton Rd");
            TestInput.Add("Johnson Smith 22 Jones Rd");
            TestInput.Add("Tim Johnson 22 Jones Rd");

            outputAddress.Add("12 Acton St");
            outputAddress.Add("31 Clifton Rd");
            outputAddress.Add("22 Jones Rd");
            outputAddress.Add("22 Jones Rd");

            outputNames.Add("Johnson,2");
            outputNames.Add("Brown,1");
            outputNames.Add("Heinrich,1");
            outputNames.Add("Jones,1");
            outputNames.Add("Matt,1");
            outputNames.Add("Smith,1");
            outputNames.Add("Tim,1");

            var lists         = process.ProcessInputString(TestInput);
            var resultNames   = lists.Item1;
            var resultAddress = lists.Item2;

            CollectionAssert.AreEqual(outputNames, resultNames);
            CollectionAssert.AreEqual(outputAddress, resultAddress);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            string inputfile      = @"C:\Files\Input\InputFile.csv";
            string outputNames    = @"C:\Files\Output\namesList.txt";
            string outputAdresses = @"C:\Files\Output\addressList.txt";

            FileReader       processFile = new FileReader();
            ProcessInputFile process     = new ProcessInputFile();
            var fileContents             = processFile.ReadCsvFile(inputfile);

            var lists       = process.ProcessInputString(fileContents);
            var nameList    = lists.Item1;
            var addressList = lists.Item2;

            processFile.WriteTextFile(outputNames, nameList);
            processFile.WriteTextFile(outputAdresses, addressList);

            Console.Read();
        }