当前位置: 首页>>代码示例>>C#>>正文


C# RouteCollection.MapOwinPath方法代码示例

本文整理汇总了C#中RouteCollection.MapOwinPath方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.MapOwinPath方法的具体用法?C# RouteCollection.MapOwinPath怎么用?C# RouteCollection.MapOwinPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RouteCollection的用法示例。


在下文中一共展示了RouteCollection.MapOwinPath方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ItShouldNotMatchShorterRequestPaths

        public void ItShouldNotMatchShorterRequestPaths()
        {
            var routes = new RouteCollection();
            routes.MapOwinPath("alpha");
            FakeHttpContext httpContext = NewHttpContext(new Uri("http://localhost/alph"));

            RouteData routeData = routes.GetRouteData(httpContext);

            routeData.ShouldBe(null);
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:10,代码来源:OwinRouteTests.cs

示例2: AddOwinRouteOnRouteCollectionShouldReturnNullForMismatchedPaths

        public void AddOwinRouteOnRouteCollectionShouldReturnNullForMismatchedPaths()
        {
            var routes = new RouteCollection();
            routes.MapOwinPath("alpha");
            FakeHttpContext httpContext = NewHttpContext(new Uri("http://localhost/beta"));

            RouteData routeData = routes.GetRouteData(httpContext);

            routeData.ShouldBe(null);
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:10,代码来源:OwinRouteTests.cs

示例3: AddOwinRouteOnRouteCollectionShouldMatchGivenPath

        public void AddOwinRouteOnRouteCollectionShouldMatchGivenPath()
        {
            var routes = new RouteCollection();
            routes.MapOwinPath("alpha");
            FakeHttpContext httpContext = NewHttpContext(new Uri("http://localhost/alpha"));

            RouteData routeData = routes.GetRouteData(httpContext);

            routeData.ShouldNotBe(null);
            routeData.RouteHandler.ShouldBeTypeOf<OwinRouteHandler>();
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:11,代码来源:OwinRouteTests.cs

示例4: ItShouldContainGivenRequestMethod

        public Task ItShouldContainGivenRequestMethod()
        {
            var routes = new RouteCollection();
            routes.MapOwinPath<AppDelegate>(string.Empty, WasCalledApp);
            RequestContext requestContext = NewRequestContext(routes, NewHttpContext(new Uri("http://localhost"), "DELTA"));

            Task task = ExecuteRequestContext(requestContext);
            return task.ContinueWith(
                _ =>
                {
                    task.Exception.ShouldBe(null);
                    WasCalled.ShouldBe(true);
                    WasCalledInput.ShouldContainKeyAndValue("owin.RequestMethod", "DELTA");
                });
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:15,代码来源:EnvironmentContentTests.cs

示例5: ItShouldHaveEmptyPathBaseAndAbsolutePath

        public Task ItShouldHaveEmptyPathBaseAndAbsolutePath()
        {
            var routes = new RouteCollection();
            routes.MapOwinPath<AppDelegate>(string.Empty, WasCalledApp);
            RequestContext requestContext = NewRequestContext(routes, NewHttpContext(new Uri("http://localhost/alpha/beta")));

            Task task = ExecuteRequestContext(requestContext);
            return task.ContinueWith(
                _ =>
                {
                    task.Exception.ShouldBe(null);
                    WasCalled.ShouldBe(true);
                    WasCalledInput.ShouldContainKeyAndValue("owin.RequestPathBase", string.Empty);
                    WasCalledInput.ShouldContainKeyAndValue("owin.RequestPath", "/alpha/beta");
                });
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:16,代码来源:EnvironmentContentTests.cs

示例6: ItShouldContainRequestContextAndAnHttpContextBaseWhenCalledThroughRoute

        public Task ItShouldContainRequestContextAndAnHttpContextBaseWhenCalledThroughRoute()
        {
            var routes = new RouteCollection();
            routes.MapOwinPath<AppDelegate>(string.Empty, WasCalledApp);
            RequestContext requestContext = NewRequestContext(routes, NewHttpContext(new Uri("http://localhost")));

            Task task = ExecuteRequestContext(requestContext);
            return task.ContinueWith(
                _ =>
                {
                    task.Exception.ShouldBe(null);
                    WasCalled.ShouldBe(true);
                    WasCalledInput.ShouldContainKeyAndValue(typeof(RequestContext).FullName, requestContext);
                    WasCalledInput.ShouldContainKey(typeof(HttpContextBase).FullName);
                });
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:16,代码来源:EnvironmentContentTests.cs

示例7: ItShouldContainAllOwinStandardKeys

        public Task ItShouldContainAllOwinStandardKeys()
        {
            var routes = new RouteCollection();
            routes.MapOwinPath<AppDelegate>(string.Empty, WasCalledApp);
            RequestContext requestContext = NewRequestContext(routes, NewHttpContext(new Uri("http://localhost")));

            Task task = ExecuteRequestContext(requestContext);
            return task.ContinueWith(
                _ =>
                {
                    task.Exception.ShouldBe(null);
                    WasCalled.ShouldBe(true);
                    WasCalledInput.ShouldContainKey("owin.RequestMethod");
                    WasCalledInput.ShouldContainKey("owin.RequestPath");
                    WasCalledInput.ShouldContainKey("owin.RequestPathBase");
                    WasCalledInput.ShouldContainKey("owin.RequestQueryString");
                    WasCalledInput.ShouldContainKey("owin.RequestScheme");
                    WasCalledInput.ShouldContainKey("owin.Version");
                });
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:20,代码来源:EnvironmentContentTests.cs

示例8: ItShouldNotMatchWhenTrailingSlashIsAbsent

        public void ItShouldNotMatchWhenTrailingSlashIsAbsent()
        {
            var routes = new RouteCollection();
            routes.MapOwinPath("alpha/");
            FakeHttpContext httpContext = NewHttpContext(new Uri("http://localhost/alpha"));

            RouteData routeData = routes.GetRouteData(httpContext);

            routeData.ShouldBe(null);
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:10,代码来源:OwinRouteTests.cs

示例9: ItShouldNotMatchPrefixOfLongerSegment

        public void ItShouldNotMatchPrefixOfLongerSegment()
        {
            var routes = new RouteCollection();
            routes.MapOwinPath("alpha");
            FakeHttpContext httpContext = NewHttpContext(new Uri("http://localhost/alphabeta"));

            RouteData routeData = routes.GetRouteData(httpContext);

            routeData.ShouldBe(null);
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:10,代码来源:OwinRouteTests.cs

示例10: AppDelegateAccessorPassesFromRouteCollectionThroughToOwinHttpHandler

        public Task AppDelegateAccessorPassesFromRouteCollectionThroughToOwinHttpHandler()
        {
            var routes = new RouteCollection();
            routes.MapOwinPath<AppDelegate>(string.Empty, WasCalledApp);
            FakeHttpContext httpContext = NewHttpContext(new Uri("http://localhost"));
            RequestContext requestContext = NewRequestContext(routes, httpContext);

            Task task = ExecuteRequestContext(requestContext);
            return task.ContinueWith(_ =>
            {
                task.Exception.ShouldBe(null);
                WasCalled.ShouldBe(true);
            });
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:14,代码来源:OwinRouteTests.cs

示例11: QueryStringShouldNotAffectMatch

        public void QueryStringShouldNotAffectMatch()
        {
            var routes = new RouteCollection();
            routes.MapOwinPath("alpha");
            FakeHttpContext httpContext = NewHttpContext(new Uri("http://localhost/alpha?gamma=delta"));

            RouteData routeData = routes.GetRouteData(httpContext);

            routeData.ShouldNotBe(null);
            routeData.RouteHandler.ShouldBeTypeOf<OwinRouteHandler>();
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:11,代码来源:OwinRouteTests.cs

示例12: ItShouldHaveUnparsedAndEscapedQueryString

        public Task ItShouldHaveUnparsedAndEscapedQueryString()
        {
            var routes = new RouteCollection();
            routes.MapOwinPath<AppDelegate>(string.Empty, WasCalledApp);
            RequestContext requestContext = NewRequestContext(routes, NewHttpContext(new Uri("http://localhost/alpha/beta?gamma=delta&omega=%2fepsilon")));

            Task task = ExecuteRequestContext(requestContext);
            return task.ContinueWith(
                _ =>
                {
                    task.Exception.ShouldBe(null);
                    WasCalled.ShouldBe(true);
                    WasCalledInput.ShouldContainKeyAndValue("owin.RequestQueryString", "gamma=delta&omega=%2fepsilon");
                });
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:15,代码来源:EnvironmentContentTests.cs

示例13: ItShouldFireOnSendingHeaders

        public Task ItShouldFireOnSendingHeaders()
        {
            var stateObject = new object();
            bool onSendingHeadersFired = false;
            bool stateObjectMatched = false;

            var routes = new RouteCollection();
            routes.MapOwinPath<AppDelegate>(string.Empty,
                env =>
                {
                    var onSendingHeadersRegister = env.Get<Action<Action<object>, object>>("server.OnSendingHeaders");
                    onSendingHeadersRegister(
                        passedObject =>
                        {
                            onSendingHeadersFired = true;
                            stateObjectMatched = object.ReferenceEquals(passedObject, stateObject);
                        }, stateObject);
                    return Utils.CompletedTask;
                });
            RequestContext requestContext = NewRequestContext(routes, NewHttpContext(new Uri("http://localhost/alpha/beta")));

            Task task = ExecuteRequestContext(requestContext);
            return task.ContinueWith(
                _ =>
                {
                    task.Exception.ShouldBe(null);
                    onSendingHeadersFired.ShouldBe(true);
                    stateObjectMatched.ShouldBe(true);
                });
        }
开发者ID:Kstal,项目名称:Microsoft.Owin,代码行数:30,代码来源:EnvironmentContentTests.cs


注:本文中的RouteCollection.MapOwinPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。