public void FilenameContainsInvalidChar([ValueSource(nameof(InvalidFilenames))] string path) { var escaped = TorrentFileInfo.PathAndFileNameEscape(path); Assert.AreNotEqual(path, escaped); Assert.IsTrue(Path.GetInvalidFileNameChars().All(t => !Path.GetFileName(escaped).Contains(t))); Assert.IsTrue(Path.GetInvalidPathChars().All(t => !Path.GetDirectoryName(escaped).Contains(t))); }
public void PathIsValid([ValueSource(nameof(ValidPaths))] string path) { Assert.AreEqual(path, TorrentFileInfo.PathAndFileNameEscape(path)); Assert.DoesNotThrow(() => Path.Combine(path, "test")); }