Ejemplo n.º 1
0
 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/"));
 }
Ejemplo n.º 2
0
 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"));
 }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
0
        public ShellRoute(RouteBase route, ShellSettings shellSettings, IWorkContextAccessor workContextAccessor, IRunningShellTable runningShellTable, Func<IDictionary<string, object>, Task> pipeline) {
            _route = route;
            _shellSettings = shellSettings;
            _runningShellTable = runningShellTable;
            _pipeline = pipeline;
            _workContextAccessor = workContextAccessor;
            if (!string.IsNullOrEmpty(_shellSettings.RequestUrlPrefix))
                _urlPrefix = new UrlPrefix(_shellSettings.RequestUrlPrefix);

            Area = route.GetAreaName();
        }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
0
        public ShellRoute(RouteBase route, ShellSettings shellSettings, IWorkContextAccessor workContextAccessor, IRunningShellTable runningShellTable, Func <IDictionary <string, object>, Task> pipeline)
        {
            _route               = route;
            _shellSettings       = shellSettings;
            _runningShellTable   = runningShellTable;
            _pipeline            = pipeline;
            _workContextAccessor = workContextAccessor;
            if (!string.IsNullOrEmpty(_shellSettings.RequestUrlPrefix))
            {
                _urlPrefix = new UrlPrefix(_shellSettings.RequestUrlPrefix);
            }

            Area = route.GetAreaName();
        }
Ejemplo n.º 7
0
        public ShellRoute(RouteBase route, ShellSettings shellSettings, ILifetimeScope shellLifetimeScope, IRunningShellTable runningShellTable)
        {
            _route = route;
            _shellSettings = shellSettings;
            _runningShellTable = runningShellTable;
            _container = new LifetimeScopeContainer(shellLifetimeScope);
            if (!string.IsNullOrEmpty(_shellSettings.RequestUrlPrefix))
                _urlPrefix = new UrlPrefix(_shellSettings.RequestUrlPrefix);

            var routeWithArea = route as IRouteWithArea;
            if (routeWithArea != null) {
                Area = routeWithArea.Area;
            }

            var routeWithDataTokens = route as Route;
            if ((routeWithDataTokens != null) && (routeWithDataTokens.DataTokens != null)) {
                Area = (routeWithDataTokens.DataTokens["area"] as string);
            }
        }
        public TenantContentService(ITenantWorkContextAccessor twca,
            IContentManager contentManager,
            ShellSettings shellSettings,
            UrlHelper urlHelper,
            IMainBitTenantService mainBitTenantService,
            ITenantService tenantService,
            IWorkContextAccessor wca)
        {
            _twca = twca;
            _contentManager = contentManager;
            _shellSettings = shellSettings;
            _urlHelper = urlHelper;
            _mainBitTenantService = mainBitTenantService;
            _tenantService = tenantService;
            _wca = wca;

            if (!string.IsNullOrEmpty(_shellSettings.RequestUrlPrefix))
                _urlPrefix = new UrlPrefix(_shellSettings.RequestUrlPrefix);
        }
Ejemplo n.º 9
0
 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"));
 }
Ejemplo n.º 10
0
 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 UrlPrefixAdjustedHttpContext(HttpContextBase httpContextBase, UrlPrefix prefix)
     : base(httpContextBase)
 {
     _prefix = prefix;
 }
 public AdjustedRequest(HttpRequestBase httpRequestBase, UrlPrefix prefix)
     : base(httpRequestBase)
 {
     _prefix = prefix;
 }
Ejemplo n.º 13
0
 public void RemoveLeadingSegmentsCanMatchEntireUrl() {
     var prefix = new UrlPrefix("foo");
     Assert.That(prefix.RemoveLeadingSegments("~/foo/"), Is.EqualTo("~/"));
     Assert.That(prefix.RemoveLeadingSegments("~/foo"), Is.EqualTo("~/"));
 }
 public AdjustedRequest(HttpRequestBase httpRequestBase, UrlPrefix prefix)
     : base(httpRequestBase)
 {
     _prefix = prefix;
 }
 public UrlPrefixAdjustedHttpContext(HttpContextBase httpContextBase, UrlPrefix prefix)
     : base(httpContextBase)
 {
     _prefix = prefix;
 }
Ejemplo n.º 16
0
 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"));
 }
Ejemplo n.º 17
0
 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"));
 }
Ejemplo n.º 18
0
 public void PrependLeadingSegmentsInsertsBeforeNormalVirtualPath() {
     var prefix = new UrlPrefix("foo");
     Assert.That(prefix.PrependLeadingSegments("~/bar"), Is.EqualTo("~/foo/bar"));
 }