/// <summary> /// Initializes a new instance of the <see cref="DefaultRouteResolver"/> class. /// </summary> /// <param name="nancyModuleCatalog">The module catalog that modules should be</param> /// <param name="routePatternMatcher">The route pattern matcher that should be used to verify if the route is a match to any of the registered routes.</param> /// <param name="moduleBuilder">The module builder that will make sure that the resolved module is full configured.</param> /// <param name="cache">The route cache that should be used to resolve modules from.</param> public DefaultRouteResolver(INancyModuleCatalog nancyModuleCatalog, IRoutePatternMatcher routePatternMatcher, INancyModuleBuilder moduleBuilder, IRouteCache cache) { this.nancyModuleCatalog = nancyModuleCatalog; this.routePatternMatcher = routePatternMatcher; this.moduleBuilder = moduleBuilder; this.cache = cache; }
public DefaultRouteResolverFixture() { this.moduleBuilder = A.Fake <INancyModuleBuilder>(); A.CallTo(() => this.moduleBuilder.BuildModule(A <NancyModule> .Ignored, A <NancyContext> .Ignored)). ReturnsLazily(r => r.Arguments[0] as NancyModule); this.catalog = A.Fake <INancyModuleCatalog>(); A.CallTo(() => this.catalog.GetModuleByKey(A <string> .Ignored, A <NancyContext> .Ignored)).Returns(expectedModule); this.expectedAction = x => HttpStatusCode.OK; this.expectedModule = new FakeNancyModule(x => { x.AddGetRoute("/foo/bar", this.expectedAction); }); A.CallTo(() => this.catalog.GetModuleByKey(A <string> .Ignored, A <NancyContext> .Ignored)).ReturnsLazily(() => this.expectedModule); this.matcher = A.Fake <IRoutePatternMatcher>(); A.CallTo(() => this.matcher.Match(A <string> .Ignored, A <string> .Ignored)).ReturnsLazily(x => new FakeRoutePatternMatchResult(c => { c.IsMatch(((string)x.Arguments[0]).Equals(((string)x.Arguments[1]))); c.AddParameter("foo", "bar"); })); this.resolver = new DefaultRouteResolver(this.catalog, this.matcher, this.moduleBuilder); }
public DefaultRouteResolverFixture() { this.moduleBuilder = A.Fake<INancyModuleBuilder>(); A.CallTo(() => this.moduleBuilder.BuildModule(A<NancyModule>.Ignored, A<NancyContext>.Ignored)). ReturnsLazily(r => r.Arguments[0] as NancyModule); this.catalog = A.Fake<INancyModuleCatalog>(); A.CallTo(() => this.catalog.GetModuleByKey(A<string>.Ignored, A<NancyContext>.Ignored)).Returns(expectedModule); this.expectedAction = x => HttpStatusCode.OK; this.expectedModule = new FakeNancyModule(x => { x.AddGetRoute("/foo/bar", this.expectedAction); }); A.CallTo(() => this.catalog.GetModuleByKey(A<string>.Ignored, A<NancyContext>.Ignored)).ReturnsLazily(() => this.expectedModule); this.matcher = A.Fake<IRoutePatternMatcher>(); A.CallTo(() => this.matcher.Match(A<string>.Ignored, A<string>.Ignored)).ReturnsLazily(x => new FakeRoutePatternMatchResult(c => { c.IsMatch(((string)x.Arguments[0]).Equals(((string)x.Arguments[1]))); c.AddParameter("foo", "bar"); })); this.resolver = new DefaultRouteResolver(this.catalog, this.matcher, this.moduleBuilder); }
public DefaultRouteResolverFixture() { this.routeDescriptionProvider = A.Fake<IRouteDescriptionProvider>(); this.moduleBuilder = A.Fake<INancyModuleBuilder>(); A.CallTo(() => this.moduleBuilder.BuildModule(A<NancyModule>.Ignored, A<NancyContext>.Ignored)). ReturnsLazily(r => r.Arguments[0] as NancyModule); this.catalog = A.Fake<INancyModuleCatalog>(); A.CallTo(() => this.catalog.GetModuleByKey(A<string>.Ignored, A<NancyContext>.Ignored)).Returns(expectedModule); this.expectedAction = x => HttpStatusCode.OK; this.expectedModule = new FakeNancyModule(x => x.AddGetRoute("/foo/bar", this.expectedAction)); A.CallTo(() => this.catalog.GetModuleByKey(A<string>.Ignored, A<NancyContext>.Ignored)).ReturnsLazily(() => this.expectedModule); this.matcher = A.Fake<IRoutePatternMatcher>(); A.CallTo(() => this.matcher.Match(A<string>.Ignored, A<string>.Ignored, A<IEnumerable<string>>.Ignored, A<NancyContext>.Ignored)).ReturnsLazily(x => new FakeRoutePatternMatchResult(c => { c.IsMatch(((string)x.Arguments[0]).Equals(((string)x.Arguments[1]))); c.AddParameter("foo", "bar"); })); this.moduleKeyGenerator = A.Fake<IModuleKeyGenerator>(); A.CallTo(() => moduleKeyGenerator.GetKeyForModuleType(A<Type>._)).ReturnsLazily(x => (string)x.Arguments[0]); }
public DefaultRouteResolverFixture() { this.routeDescriptionProvider = A.Fake <IRouteDescriptionProvider>(); this.moduleBuilder = A.Fake <INancyModuleBuilder>(); A.CallTo(() => this.moduleBuilder.BuildModule(A <NancyModule> .Ignored, A <NancyContext> .Ignored)). ReturnsLazily(r => r.Arguments[0] as NancyModule); this.catalog = A.Fake <INancyModuleCatalog>(); A.CallTo(() => this.catalog.GetModuleByKey(A <string> .Ignored, A <NancyContext> .Ignored)).Returns(expectedModule); this.expectedAction = x => HttpStatusCode.OK; this.expectedModule = new FakeNancyModule(x => x.AddGetRoute("/foo/bar", this.expectedAction)); A.CallTo(() => this.catalog.GetModuleByKey(A <string> .Ignored, A <NancyContext> .Ignored)).ReturnsLazily(() => this.expectedModule); this.matcher = A.Fake <IRoutePatternMatcher>(); A.CallTo(() => this.matcher.Match(A <string> .Ignored, A <string> .Ignored, A <IEnumerable <string> > .Ignored, A <NancyContext> .Ignored)).ReturnsLazily(x => new FakeRoutePatternMatchResult(c => { c.IsMatch(((string)x.Arguments[0]).Equals(((string)x.Arguments[1]))); c.AddParameter("foo", "bar"); })); this.moduleKeyGenerator = A.Fake <IModuleKeyGenerator>(); A.CallTo(() => moduleKeyGenerator.GetKeyForModuleType(A <Type> ._)).ReturnsLazily(x => (string)x.Arguments[0]); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultRouteResolver"/> class. /// </summary> /// <param name="nancyModuleCatalog">The module catalog that modules should be</param> /// <param name="routePatternMatcher">The route pattern matcher that should be used to verify if the route is a match to any of the registered routes.</param> /// <param name="moduleBuilder">The module builder that will make sure that the resolved module is full configured.</param> /// <param name="cache">The route cache that should be used to resolve modules from.</param> /// <param name="responseProcessors"></param> public DefaultRouteResolver(INancyModuleCatalog nancyModuleCatalog, IRoutePatternMatcher routePatternMatcher, INancyModuleBuilder moduleBuilder, IRouteCache cache, IEnumerable <IResponseProcessor> responseProcessors) { this.nancyModuleCatalog = nancyModuleCatalog; this.routePatternMatcher = routePatternMatcher; this.moduleBuilder = moduleBuilder; this.cache = cache; this.responseProcessors = responseProcessors; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultRouteResolver"/> class. /// </summary> /// <param name="nancyModuleCatalog">The module catalog that modules should be</param> /// <param name="routePatternMatcher">The route pattern matcher that should be used to verify if the route is a match to any of the registered routes.</param> /// <param name="moduleBuilder">The module builder that will make sure that the resolved module is full configured.</param> /// <param name="cache">The route cache that should be used to resolve modules from.</param> /// <param name="responseProcessors"></param> public DefaultRouteResolver(INancyModuleCatalog nancyModuleCatalog, IRoutePatternMatcher routePatternMatcher, INancyModuleBuilder moduleBuilder, IRouteCache cache, IEnumerable<IResponseProcessor> responseProcessors) { this.nancyModuleCatalog = nancyModuleCatalog; this.routePatternMatcher = routePatternMatcher; this.moduleBuilder = moduleBuilder; this.cache = cache; this.responseProcessors = responseProcessors; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultRouteResolver"/> class. /// </summary> /// <param name="nancyModuleCatalog">The module catalog that modules should be</param> /// <param name="routePatternMatcher">The route pattern matcher that should be used to verify if the route is a match to any of the registered routes.</param> /// <param name="moduleBuilder">The module builder that will make sure that the resolved module is full configured.</param> /// <param name="cache">The route cache that should be used to resolve modules from.</param> /// <param name="responseProcessors"></param> public NSembleRouteResolver(INancyModuleCatalog nancyModuleCatalog, IRoutePatternMatcher routePatternMatcher, INancyModuleBuilder moduleBuilder, IRouteCache cache, IEnumerable <IResponseProcessor> responseProcessors, global::Nancy.TinyIoc.TinyIoCContainer container) { this.nancyModuleCatalog = nancyModuleCatalog; this.routePatternMatcher = routePatternMatcher; this.moduleBuilder = moduleBuilder; this.cache = cache; this.responseProcessors = responseProcessors; _container = container; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultRouteResolver"/> class. /// </summary> /// <param name="nancyModuleCatalog">The module catalog that modules should be</param> /// <param name="routePatternMatcher">The route pattern matcher that should be used to verify if the route is a match to any of the registered routes.</param> /// <param name="moduleBuilder">The module builder that will make sure that the resolved module is full configured.</param> /// <param name="cache">The route cache that should be used to resolve modules from.</param> /// <param name="responseProcessors"></param> public NSembleRouteResolver(INancyModuleCatalog nancyModuleCatalog, IRoutePatternMatcher routePatternMatcher, INancyModuleBuilder moduleBuilder, IRouteCache cache, IEnumerable<IResponseProcessor> responseProcessors, global::Nancy.TinyIoc.TinyIoCContainer container) { this.nancyModuleCatalog = nancyModuleCatalog; this.routePatternMatcher = routePatternMatcher; this.moduleBuilder = moduleBuilder; this.cache = cache; this.responseProcessors = responseProcessors; _container = container; }
public RouteBuilder(IRoutePatternMatcher routePatternMatcher) { this.routePatternMatcher = routePatternMatcher; }
public DefaultRouteBuilderFactory(IRoutePatternMatcher routePatternMatcher) { this.routePatternMatcher = routePatternMatcher; }
public DefaultRouteResolver(INancyModuleCatalog nancyModuleCatalog, IRoutePatternMatcher routePatternMatcher, ITemplateEngineSelector templateEngineSelector) { this.nancyModuleCatalog = nancyModuleCatalog; this.routePatternMatcher = routePatternMatcher; this.templateEngineSelector = templateEngineSelector; }
/// <summary> /// Configures the bootstrapper to use the provided instance of <see cref="IRoutePatternMatcher"/>. /// </summary> /// <param name="routePatternMatcher">The <see cref="IRoutePatternMatcher"/> instance that should be used by the bootstrapper.</param> /// <returns>An instance to the current <see cref="FakeNancyBootstrapperConfigurator"/>.</returns> public FakeNancyBootstrapperConfigurator RoutePatternMatcher(IRoutePatternMatcher routePatternMatcher) { this.bootstrapper.configuredInstances[typeof(IRoutePatternMatcher)] = routePatternMatcher; return(this); }
public Route(IEndpoint endpoint, IRouteDefinition routeDefinition, IRoutePatternMatcher routePatternMatcher) { this.routeDefinition = routeDefinition; this.routePatternMatcher = routePatternMatcher; Endpoint = endpoint; }