public void RemoveLeadingSegmentsOnlyMatchesFullSegment()
 {
     var prefix = new UrlPrefix("foo");
     Assert.That(prefix.RemoveLeadingSegments("~/foo/bar"), Is.EqualTo("~/bar"));
     Assert.That(prefix.RemoveLeadingSegments("~/fooo/bar"), Is.EqualTo("~/fooo/bar"));
     Assert.That(prefix.RemoveLeadingSegments("~/fo/bar"), Is.EqualTo("~/fo/bar"));
 }
 public void PrependLeadingSegmentsPreservesNatureOfIncomingPath()
 {
     var prefix = new UrlPrefix("foo");
     Assert.That(prefix.PrependLeadingSegments("~/bar"), Is.EqualTo("~/foo/bar"));
     Assert.That(prefix.PrependLeadingSegments("/bar"), Is.EqualTo("/foo/bar"));
     Assert.That(prefix.PrependLeadingSegments("bar"), Is.EqualTo("foo/bar"));
 }
 public void RemoveLeadingSegmentsMayContainSlash()
 {
     var prefix = new UrlPrefix("foo/quux");
     Assert.That(prefix.RemoveLeadingSegments("~/foo/quux/bar"), Is.EqualTo("~/bar"));
     Assert.That(prefix.RemoveLeadingSegments("~/foo/bar"), Is.EqualTo("~/foo/bar"));
     Assert.That(prefix.RemoveLeadingSegments("~/quux/bar"), Is.EqualTo("~/quux/bar"));
 }
 public void PrependLeadingSegmentsHandlesShortUrlConditionsAppropriately()
 {
     var prefix = new UrlPrefix("foo");
     Assert.That(prefix.PrependLeadingSegments("~/"), Is.EqualTo("~/foo/"));
     Assert.That(prefix.PrependLeadingSegments("/"), Is.EqualTo("/foo/"));
     Assert.That(prefix.PrependLeadingSegments("~"), Is.EqualTo("~/foo/"));
     Assert.That(prefix.PrependLeadingSegments(""), Is.EqualTo("foo/"));
 }
 public void RemoveLeadingSegmentsIgnoreLeadingAndTrailingCharactersOnInput()
 {
     var prefix = new UrlPrefix("foo");
     Assert.That(prefix.RemoveLeadingSegments("~/foo/bar"), Is.EqualTo("~/bar"));
     var prefix2 = new UrlPrefix("~/foo");
     Assert.That(prefix2.RemoveLeadingSegments("~/foo/bar"), Is.EqualTo("~/bar"));
     var prefix3 = new UrlPrefix("foo/");
     Assert.That(prefix3.RemoveLeadingSegments("~/foo/bar"), Is.EqualTo("~/bar"));
 }
        public ShellRoute(RouteBase route, ShellSettings shellSettings, IWorkContextAccessor workContextAccessor, IRunningShellTable runningShellTable)
        {
            _route = route;
            _shellSettings = shellSettings;
            _runningShellTable = runningShellTable;
            _workContextAccessor = workContextAccessor;
            if (!string.IsNullOrEmpty(_shellSettings.RequestUrlPrefix))
                _urlPrefix = new UrlPrefix(_shellSettings.RequestUrlPrefix);

            Area = route.GetAreaName();
        }
Example #7
0
        public ShellRoute(RouteBase route, ShellSettings shellSettings, IWorkContextAccessor workContextAccessor, IRunningShellTable runningShellTable)
        {
            _route               = route;
            _shellSettings       = shellSettings;
            _runningShellTable   = runningShellTable;
            _workContextAccessor = workContextAccessor;
            if (!string.IsNullOrEmpty(_shellSettings.RequestUrlPrefix))
            {
                _urlPrefix = new UrlPrefix(_shellSettings.RequestUrlPrefix);
            }

            Area = route.GetAreaName();
        }
 public void RemoveLeadingSegmentsIsCaseInsensitive()
 {
     var prefix = new UrlPrefix("Foo");
     Assert.That(prefix.RemoveLeadingSegments("~/foo/bar"), Is.EqualTo("~/bar"));
     Assert.That(prefix.RemoveLeadingSegments("~/FOO/BAR"), Is.EqualTo("~/BAR"));
 }
 public void RemoveLeadingSegmentsCanMatchEntireUrl()
 {
     var prefix = new UrlPrefix("foo");
     Assert.That(prefix.RemoveLeadingSegments("~/foo/"), Is.EqualTo("~/"));
     Assert.That(prefix.RemoveLeadingSegments("~/foo"), Is.EqualTo("~/"));
 }
 public void PrependLeadingSegmentsInsertsBeforeNormalVirtualPath()
 {
     var prefix = new UrlPrefix("foo");
     Assert.That(prefix.PrependLeadingSegments("~/bar"), Is.EqualTo("~/foo/bar"));
 }
 public AdjustedRequest(HttpRequestBase httpRequestBase, UrlPrefix prefix)
     : base(httpRequestBase)
 {
     _prefix = prefix;
 }
 public UrlPrefixAdjustedHttpContext(HttpContextBase httpContextBase, UrlPrefix prefix)
     : base(httpContextBase)
 {
     _prefix = prefix;
 }
 public UrlPrefixAdjustedHttpContext(HttpContextBase httpContextBase, UrlPrefix prefix)
     : base(httpContextBase)
 {
     _prefix = prefix;
 }
 public AdjustedRequest(HttpRequestBase httpRequestBase, UrlPrefix prefix)
     : base(httpRequestBase)
 {
     _prefix = prefix;
 }