Beispiel #1
0
        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)));
        }
Beispiel #2
0
 public void PathIsValid([ValueSource(nameof(ValidPaths))] string path)
 {
     Assert.AreEqual(path, TorrentFileInfo.PathAndFileNameEscape(path));
     Assert.DoesNotThrow(() => Path.Combine(path, "test"));
 }