public void ToAppRelative() { Assert.AreEqual("~/hi", VPU.ToAppRelative("~/hi", null)); Assert.AreEqual("~/hi", VPU.ToAppRelative("~/hi", "")); Assert.AreEqual("~/hi", VPU.ToAppRelative("~/hi", "/..")); Assert.AreEqual("~/hi", VPU.ToAppRelative("~/hi", "me")); Assert.AreEqual("~", VPU.ToAppRelative("~", "/ROOT")); Assert.AreEqual("~/", VPU.ToAppRelative("~/", "/ROOT")); Assert.AreEqual("~/blah", VPU.ToAppRelative("~/blah", "/ROOT/")); Assert.AreEqual("~/blah2/", VPU.ToAppRelative("~/blah1/../blah2/", "/ROOT/")); Assert.AreEqual("~/", VPU.ToAppRelative("/ROOT", "/ROOT")); Assert.AreEqual("~/", VPU.ToAppRelative("/ROOT/", "/ROOT")); Assert.AreEqual("~/blah/blah/", VPU.ToAppRelative("/ROOT/blah//blah//", "/ROOT")); Assert.AreEqual("~/blah/blah/", VPU.ToAppRelative("/ROOT/blah\\blah/", "/ROOT")); Assert.AreEqual("~/blah2/", VPU.ToAppRelative("/ROOT/blah1/../blah2/", "/ROOT")); Assert.AreEqual("~/blah1/blah2/", VPU.ToAppRelative("/ROOT/blah1/./blah2/", "/ROOT")); Assert.AreEqual("~/blah1", VPU.ToAppRelative("/ROOT/blah1/blah2/..", "/ROOT")); Assert.AreEqual("~/", VPU.ToAppRelative("/ROOT/blah1/..", "/ROOT")); Assert.AreEqual("~/blah1/", VPU.ToAppRelative("/ROOT/blah1/blah2/../", "/ROOT")); Assert.AreEqual("~/", VPU.ToAppRelative("/ROOT/blah1/../", "/ROOT")); Assert.AreEqual("~/blah1", VPU.ToAppRelative("/ROOT/blah1/.", "/ROOT")); Assert.AreEqual("~/", VPU.ToAppRelative("/ROOT/.", "/ROOT")); Assert.AreEqual("~/blah1/", VPU.ToAppRelative("/ROOT/blah1/./", "/ROOT")); Assert.AreEqual("~/", VPU.ToAppRelative("/ROOT/./", "/ROOT")); Assert.AreEqual("~/ROOT", VPU.ToAppRelative("/ROOT", "/")); Assert.AreEqual("~/ROOT", VPU.ToAppRelative("/ROOT", "/hi/..")); Assert.AreEqual("~/ROOT", VPU.ToAppRelative("/ROOT/hi/..", "/")); }
/// <summary> Gets the <see cref="Type"/> for the specified <paramref name="absolutePath"/>. </summary> /// <include file='..\doc\include\ExecutionEngine\WxeHandler.xml' path='WxeHandler/GetTypeByPath/*' /> protected virtual Type GetTypeByPath(string absolutePath) { ArgumentUtility.CheckNotNullOrEmpty("absolutePath", absolutePath); string relativePath = VirtualPathUtility.ToAppRelative(absolutePath); Type type = UrlMapping.UrlMappingConfiguration.Current.Mappings.FindType(relativePath); if (type == null) { throw new WxeException(string.Format("Could not map the path '{0}' to a WXE function.", absolutePath)); } return(type); }
public void ToAppRelative_Exc8() { VPU.ToAppRelative("/../ROOT/hi", "/ROOT"); }
//The relative virtual path 'hi' is not allowed here. public void ToAppRelative_Exc7_a() { VPU.ToAppRelative("hi", null); }
//The relative virtual path 'hi' is not allowed here. public void ToAppRelative_Exc7() { VPU.ToAppRelative("hi", "/ROOT"); }
public void ToAppRelative_Exc6() { VPU.ToAppRelative("", "/ROOT"); }
public void ToAppRelative_Exc5() { VPU.ToAppRelative(null, "/ROOT"); }
public void ToAppRelative_Exc3() { VPU.ToAppRelative("/ROOT/hi", "hi"); }
public void ToAppRelative_Exc2() { VPU.ToAppRelative("/ROOT/hi", null); }
public static void ToAppRelative2_Load(Page p) { Assert.AreEqual("~/hi", VPU.ToAppRelative("~/../NunitWeb/hi", "/NunitWeb")); }