Example #1
0
        /// <summary>
        /// For The Purposes of this Kata it is assumed that only valid filenames will be provided and that the files are in the correct format
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public FileParserResponse Read(string path)
        {
            if (string.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            string[] readText           = File.ReadAllLines(path);
            var      fileParserResponse = new FileParserResponse()
            {
                Lines = readText.AsEnumerable()
            };

            return(fileParserResponse);
        }
Example #2
0
        public void ReadSuccess()
        {
            var expected = new FileParserResponse()
            {
                Lines = new List <string>()
                {
                    " _  _  _  _  _  _  _  _  _",
                    ""
                }
            };

            var actual = ItemUnderTest.Read($"..\\..\\..\\FileParserTests.txt");

            Assert.AreEqual(expected.Lines.ToArray()[0], actual.Lines.ToArray()[0]);
            Assert.AreEqual(expected.Lines.ToArray()[1], actual.Lines.ToArray()[1]);
        }