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))); }
public void InterpreteBrokenFile() { string[] fileContent = File.ReadAllLines("TestFiles\\BrokenLine.txt"); string[] interpretedLines = OCRLineInterpreter.InterpreteFileLines(fileContent); CollectionAssert.AreEqual(new[] { "1337", "invalid line", "42" }, interpretedLines); }
public void InterpreteSymetricFile() { string[] fileContent = File.ReadAllLines("TestFiles\\TwoLines.txt"); string[] interpretedLines = OCRLineInterpreter.InterpreteFileLines(fileContent); CollectionAssert.AreEqual(new[] { "88", "88" }, interpretedLines); }
public void InterpreteRaggedFile() { string[] fileContent = File.ReadAllLines("TestFiles\\DifferentLengths.txt"); string[] interpretedLines = OCRLineInterpreter.InterpreteFileLines(fileContent); CollectionAssert.AreEqual(new[] { "1337", "42" }, interpretedLines); }