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")); }
public void TestLocal() { var fileSystem = new LocalFileSystem(Path.GetFullPath(@"D:\Some\Path")); Assert.AreEqual(Path.GetFullPath($@"D:\Some\Path{Path.DirectorySeparatorChar}_mypartial.liquid"), fileSystem.FullPath("mypartial")); Assert.AreEqual(Path.GetFullPath($@"D:\Some\Path{Path.DirectorySeparatorChar}dir{Path.DirectorySeparatorChar}_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")); }
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")); }
public void CanResolvePartialTemplate() { const string templatePath = "C:\\Program Files (x86)\\ProSuite\\bin\\config\\template.html.tpl"; const string partialName = "partial_name"; string templateDirectory = Assert.NotNull(Path.GetDirectoryName(Path.GetFullPath(templatePath))); var fileSystem = new LocalFileSystem(templateDirectory); string result = fileSystem.FullPath(partialName); Console.WriteLine(result); NUnit.Framework.Assert.AreEqual(Path.Combine(templateDirectory, $"_{partialName}.liquid"), result); }
public void TestLocalWithBracketsInPath() { var fileSystem = new LocalFileSystem(Path.GetFullPath(@"D:\Some (thing)\Path")); Assert.AreEqual(Path.GetFullPath($@"D:\Some (thing)\Path{Path.DirectorySeparatorChar}_mypartial.liquid"), fileSystem.FullPath("mypartial")); Assert.AreEqual(Path.GetFullPath($@"D:\Some (thing)\Path{Path.DirectorySeparatorChar}dir{Path.DirectorySeparatorChar}_mypartial.liquid"), fileSystem.FullPath("dir/mypartial")); }