Exemple #1
0
        public void TestLocal()
        {
            LocalFileSystem fileSystem = new LocalFileSystem(@"D:\Some\Path");
            Assert.AreEqual(@"D:\Some\Path\_mypartial.liquid", fileSystem.FullPath("mypartial"));
            Assert.AreEqual(@"D:\Some\Path\dir\_mypartial.liquid", fileSystem.FullPath("dir/mypartial"));

            Assert.Throws<FileSystemException>(() => fileSystem.FullPath("../dir/mypartial"));
            Assert.Throws<FileSystemException>(() => fileSystem.FullPath("/dir/../../dir/mypartial"));
            Assert.Throws<FileSystemException>(() => fileSystem.FullPath("/etc/passwd"));
            Assert.Throws<FileSystemException>(() => fileSystem.FullPath(@"C:\mypartial"));
        }
Exemple #2
0
 public void TestLocalWithBracketsInPath()
 {
     LocalFileSystem fileSystem = new LocalFileSystem(@"D:\Some (thing)\Path");
     Assert.AreEqual(@"D:\Some (thing)\Path\_mypartial.liquid", fileSystem.FullPath("mypartial"));
     Assert.AreEqual(@"D:\Some (thing)\Path\dir\_mypartial.liquid", fileSystem.FullPath("dir/mypartial"));
 }