public void TestIsValidFilename() { string[] validPaths = { @"C:\Test.txt", @"X:\Test\Folder\With\Many\Sub\Folders\test.txt", @"C:\Test,abc.txt" }; string[] invalidPaths = { @"C:\Test<.txt", @"C:\Test>.txt", @"C:\Test?.txt", @"C:\Test*.txt", @"C:\Test|.txt", @"C:\Test"".txt" }; foreach (var p in validPaths) { Assert.IsTrue(ValidName.IsValidPath(p), "Expected '" + p + "' to be a valid path"); } foreach (var p in invalidPaths) { Assert.IsFalse(ValidName.IsValidPath(p), "Expected '" + p + "' to be an invalid path"); } }