public void SplitLines()
        {
            string[]  fileContent = File.ReadAllLines("TestFiles\\TwoLines.txt");
            OCRLine[] result      = OCRLineInterpreter.CreateOcrLines(fileContent);

            Assert.AreEqual(2, result.Length);
        }
        public void SplitMultipleLines()
        {
            OCRLine[] result = OCRLineInterpreter.CreateOcrLines(Enumerable.Repeat(" ", 3));
            Assert.AreEqual(1, result.Length);

            result = OCRLineInterpreter.CreateOcrLines(Enumerable.Repeat(" ", 7));
            Assert.AreEqual(2, result.Length);

            result = OCRLineInterpreter.CreateOcrLines(Enumerable.Repeat(" ", 11));
            Assert.AreEqual(3, result.Length);
        }
        public void SplitLineException()
        {
            Assert.ThrowsException <FormatException>(
                () => OCRLineInterpreter.CreateOcrLines(new[] { "", "" }));

            Assert.ThrowsException <FormatException>(
                () => OCRLineInterpreter.CreateOcrLines(Enumerable.Repeat(" ", 5)));

            Assert.ThrowsException <FormatException>(
                () => OCRLineInterpreter.CreateOcrLines(Enumerable.Repeat(" ", 9)));

            Assert.ThrowsException <FormatException>(
                () => OCRLineInterpreter.CreateOcrLines(Enumerable.Repeat(" ", 14)));
        }
示例#4
0
 public void InterpreteBrokenFile()
 {
     string[] fileContent      = File.ReadAllLines("TestFiles\\BrokenLine.txt");
     string[] interpretedLines = OCRLineInterpreter.InterpreteFileLines(fileContent);
     CollectionAssert.AreEqual(new[] { "1337", "invalid line", "42" }, interpretedLines);
 }
示例#5
0
 public void InterpreteSymetricFile()
 {
     string[] fileContent      = File.ReadAllLines("TestFiles\\TwoLines.txt");
     string[] interpretedLines = OCRLineInterpreter.InterpreteFileLines(fileContent);
     CollectionAssert.AreEqual(new[] { "88", "88" }, interpretedLines);
 }
示例#6
0
 public void InterpreteRaggedFile()
 {
     string[] fileContent      = File.ReadAllLines("TestFiles\\DifferentLengths.txt");
     string[] interpretedLines = OCRLineInterpreter.InterpreteFileLines(fileContent);
     CollectionAssert.AreEqual(new[] { "1337", "42" }, interpretedLines);
 }