本文整理汇总了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);
}
示例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);
}
示例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>();
}
示例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");
});
}
示例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");
});
}
示例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);
});
}
示例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");
});
}
示例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);
}
示例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);
}
示例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);
});
}
示例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>();
}
示例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");
});
}
示例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);
});
}