Esempio n. 1
0
        public FileInfo FileHandling(FileInfo fileInfo)
        {
            var rowIndex = 0;
            var outFile  = Path.ChangeExtension(fileInfo.FullName, ".out");

            using (var streamReader = new StreamReader(fileInfo.Name))
            {
                using (var streamWriter = new StreamWriter(outFile))
                {
                    do
                    {
                        var row = streamReader.ReadLine();
                        if (rowIndex == 0)
                        {
                            rowIndex++;
                            continue;
                        }

                        var convertedRow = _converter.ConvertString(row);

                        var outputRow = $"Case #{rowIndex}: {convertedRow}";

                        streamWriter.WriteLine(outputRow);
                        rowIndex++;
                    }while (streamReader.EndOfStream == false);
                }
            }

            return(new FileInfo(outFile));
        }
Esempio n. 2
0
 public void ConvertString_ShouldReturn_ExpectedResult(string expected, string input)
 {
     Assert.AreEqual(expected, _t9Converter.ConvertString(input));
 }