public void testFileHandler_readFileAsString_invalid() { String expectedString = "empty"; fileHandler fh = new file_handler.fileHandler(); Assert.AreEqual(expectedString, fh.readFileAsString()); }
public void testFileHandler_readFileAsString_valid() { String expectedString = "4 2 - 1\n- - -2\n3 - 2 -\n- 4 - 3"; fileHandler fh = new file_handler.fileHandler(); fh.getFileName("4x4.txt"); Assert.AreEqual(Regex.Replace(expectedString, @"[\u000A\u000B\u000C\u000D\u2028\u2029\u0085 ]+", String.Empty), Regex.Replace(fh.readFileAsString(), @"[\u000A\u000B\u000C\u000D\u2028\u2029\u0085 ]+", String.Empty)); }
public void testFileHandler_readFileAsArray_valid() { fileHandler fh = new file_handler.fileHandler(); fh.getFileName("4x4.txt"); Assert.AreEqual("4 2 - 1", fh.readFileAsArray()[0]); Assert.AreEqual("- - - 2", fh.readFileAsArray()[1]); Assert.AreEqual("3 - 2 -", fh.readFileAsArray()[2]); Assert.AreEqual("- 4 - 3", fh.readFileAsArray()[3]); }
public void testFileHandler_readFileAsArray_invalid() { fileHandler fh = new file_handler.fileHandler(); Assert.AreSame(new String[] { }.GetType(), fh.readFileAsArray().GetType()); }
public void testFileHandler_getFileName_invalid() { fileHandler fh = new file_handler.fileHandler(); Assert.IsFalse(fh.getFileName("fileThatDoesNotExist.txt")); }
public void testFileHandler_getFileName_valid() { fileHandler fh = new file_handler.fileHandler(); Assert.IsTrue(fh.getFileName("4x4.txt")); }