public void MakeRelative6_a() { Assert.AreEqual("directory1", VPU.MakeRelative("/directory1/../", "/directory1")); Assert.AreEqual("", VPU.MakeRelative("/directory1", "/directory1/../")); Assert.AreEqual("./", VPU.MakeRelative("/", "/directory1/../")); Assert.AreEqual("directory1", VPU.MakeRelative("/directory1", "/directory2/../directory1")); }
public void MakeRelative6() { Assert.AreEqual("./", VPU.MakeRelative("/", "/")); Assert.AreEqual("directory1", VPU.MakeRelative("/directory1", "/directory1")); Assert.AreEqual("directory2", VPU.MakeRelative("/directory1", "/directory2")); Assert.AreEqual("directory1", VPU.MakeRelative("/", "/directory1")); Assert.AreEqual("", VPU.MakeRelative("/directory1", "/")); Assert.AreEqual("./", VPU.MakeRelative("/directory1/", "/directory1/")); Assert.AreEqual("directory1/file1.aspx", VPU.MakeRelative("/directory1", "/directory1/file1.aspx")); Assert.AreEqual("file1.aspx", VPU.MakeRelative("/directory1/file1.aspx", "/directory1/file1.aspx")); Assert.AreEqual("file1.aspx", VPU.MakeRelative("/directory1/", "/directory1/file1.aspx")); Assert.AreEqual("../directory2/file2.aspx", VPU.MakeRelative("/directory1/file1.aspx", "/directory2/file2.aspx")); }
public static void MakeRelative7_Load(Page p) { Assert.AreEqual("./", VPU.MakeRelative("~", "~"), "~, ~"); Assert.AreEqual("./", VPU.MakeRelative("~/", "~/")); Assert.AreEqual("./", VPU.MakeRelative("~//", "~//")); Assert.AreEqual("./", VPU.MakeRelative("~", "~//"), "~, ~//"); Assert.AreEqual("directory1", VPU.MakeRelative("~/directory1", "~/directory1")); Assert.AreEqual("directory2", VPU.MakeRelative("~/directory1", "~/directory2")); Assert.AreEqual("directory1", VPU.MakeRelative("~/", "~/directory1")); Assert.AreEqual("", VPU.MakeRelative("~/directory1", "~/")); Assert.AreEqual("./", VPU.MakeRelative("~/directory1/", "~/directory1/")); Assert.AreEqual("directory1/file1.aspx", VPU.MakeRelative("~/directory1", "~/directory1/file1.aspx")); Assert.AreEqual("file1.aspx", VPU.MakeRelative("~/directory1/", "~/directory1/file1.aspx")); Assert.AreEqual("../directory2/file2.aspx", VPU.MakeRelative("~/directory1/file1.aspx", "~/directory2/file2.aspx")); Assert.AreEqual("directory1", VPU.MakeRelative("~/directory1/../", "~/directory1")); Assert.AreEqual("", VPU.MakeRelative("~/directory1", "~/directory1/../")); Assert.AreEqual("./", VPU.MakeRelative("~/", "~/directory1/../")); Assert.AreEqual("directory1", VPU.MakeRelative("~/directory1", "~/directory2/../directory1")); Assert.AreEqual("../", VPU.MakeRelative("~", "/")); Assert.AreEqual("NunitWeb/", VPU.MakeRelative("/", "~")); }
public void MakeRelative5() { Assert.AreEqual("", VPU.MakeRelative("", "")); Assert.AreEqual("", VPU.MakeRelative("/something", "")); }
public void MakeRelative4() { VPU.MakeRelative("aa", "/i"); }
public void MakeRelative3() { VPU.MakeRelative("/", "i"); }
public void MakeRelative2() { VPU.MakeRelative("", null); }
public void MakeRelative1() { VPU.MakeRelative(null, ""); }
/* this test when run on MS generates the following stack trace (NRE): * at System.Web.Util.UrlPath.MakeVirtualPathAppAbsolute(String virtualPath, String applicationPath) * at System.Web.Util.UrlPath.MakeRelative(String from, String to) * at System.Web.VirtualPathUtility.MakeRelative(String fromPath, String toPath) * at MonoTests.System.Web.VirtualPathUtilityTest.MakeRelative() */ public void MakeRelative() { Assert.AreEqual("../bar", VPU.MakeRelative("~/foo/hi", "~/foo/bar"), "A1"); }