public DefaultRouteCache(INancyModuleCatalog moduleCatalog, IModuleKeyGenerator moduleKeyGenerator) { _ModuleKeyGenerator = moduleKeyGenerator; _Cache = new List<RouteCacheEntry>(); BuildCache(moduleCatalog.GetAllModules()); }
/// <summary> /// Initializes a new instance of the <see cref="UriTemplateRouteResolver"/> class. /// </summary> /// <param name="inner">The inner.</param> /// <param name="moduleCatalog">The module catalog.</param> /// <param name="builder">The builder.</param> /// <param name="environment">The environment.</param> public UriTemplateRouteResolver(DefaultRouteResolver inner, INancyModuleCatalog moduleCatalog, INancyModuleBuilder builder, INancyEnvironment environment) { this.inner = inner; this.moduleCatalog = moduleCatalog; this.builder = builder; this.globalizationConfiguraton = environment.GetValue <GlobalizationConfiguration>(); }
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> 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 SwaggerAnnotationsProvider(INancyModuleCatalog moduleCatalog, NancyContext context, ISwaggerModelCatalog modelCatalog, ISwaggerTagCatalog tagCatalog) { _moduleCatalog = moduleCatalog; _context = context; _modelCatalog = modelCatalog; _tagCatalog = tagCatalog; }
public RoutesModel(NancyContext ctx, INancyModuleCatalog catalog) { var routes = from module in catalog.GetAllModules(ctx) from route in module.Routes select new RouteModel(module, route); this.AddRange(routes); }
/// <summary> /// Initializes a new instance of the RouteCacheFixture class. /// </summary> public RouteCacheFixture() { this.routeSegmentExtractor = A.Fake <IRouteSegmentExtractor>(); this.fakeModuleCatalog = new FakeModuleCatalog(); this.routeCache = new RouteCache(this.fakeModuleCatalog, new FakeModuleKeyGenerator(), A.Fake <INancyContextFactory>(), this.routeSegmentExtractor); }
/// <summary> /// Initializes a new instance of the RouteCacheFixture class. /// </summary> public RouteCacheFixture() { this.routeSegmentExtractor = A.Fake<IRouteSegmentExtractor>(); this.fakeModuleCatalog = new FakeModuleCatalog(); this.routeCache = new RouteCache(this.fakeModuleCatalog, new FakeModuleKeyGenerator(), A.Fake<INancyContextFactory>(), this.routeSegmentExtractor); }
/// <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="NancyRebuildableCache"/> class. /// </summary> /// <param name="moduleCatalog">The <see cref="INancyModuleCatalog"/> that should be used by the cache.</param> /// <param name="moduleKeyGenerator">The <see cref="IModuleKeyGenerator"/> used to generate module keys.</param> /// <param name="contextFactory">The <see cref="INancyContextFactory"/> that should be used to create a context instance.</param> /// <param name="routeSegmentExtractor"> </param> public NancyRebuildableCache(INancyModuleCatalog moduleCatalog, IModuleKeyGenerator moduleKeyGenerator, INancyContextFactory contextFactory) : base(moduleCatalog, moduleKeyGenerator, contextFactory) { this.moduleKeyGenerator = moduleKeyGenerator; //this.routeSegmentExtractor = routeSegmentExtractor; //this.routeDescriptionProvider = routeDescriptionProvider; this.contextFactory = contextFactory; this.moduleCatalog = moduleCatalog; }
/// <summary> /// Initializes a new instance of the <see cref="RouteCache"/> class. /// </summary> /// <param name="moduleCatalog">The <see cref="INancyModuleCatalog"/> that should be used by the cache.</param> /// <param name="moduleKeyGenerator">The <see cref="IModuleKeyGenerator"/> used to generate module keys.</param> /// <param name="contextFactory">The <see cref="INancyContextFactory"/> that should be used to create a context instance.</param> public RouteCache(INancyModuleCatalog moduleCatalog, IModuleKeyGenerator moduleKeyGenerator, INancyContextFactory contextFactory) { this.moduleKeyGenerator = moduleKeyGenerator; using (var context = contextFactory.Create()) { this.BuildCache(moduleCatalog.GetAllModules(context)); } }
/// <summary> /// Initializes a new instance of the <see cref="DefaultRouteResolver"/> class, using /// the provided <paramref name="catalog"/>, <paramref name="moduleBuilder"/>, /// <paramref name="routeCache"/> and <paramref name="trie"/>. /// </summary> /// <param name="catalog">A <see cref="INancyModuleCatalog"/> instance.</param> /// <param name="moduleBuilder">A <see cref="INancyModuleBuilder"/> instance.</param> /// <param name="routeCache">A <see cref="IRouteCache"/> instance.</param> /// <param name="trie">A <see cref="IRouteResolverTrie"/> instance.</param> public SoapRouteResolver(INancyModuleCatalog catalog, INancyModuleBuilder moduleBuilder, IRouteCache routeCache, IRouteResolverTrie trie)// : base(catalog, moduleBuilder, routeCache, trie) { this.catalog = catalog; this.moduleBuilder = moduleBuilder; this.routeCache = routeCache; this.trie = trie; this.BuildTrie(); }
public DefaultRouteResolver(INancyModuleCatalog catalog, INancyModuleBuilder moduleBuilder, IRouteCache routeCache, IRouteResolverTrie trie) { this.catalog = catalog; this.moduleBuilder = moduleBuilder; this.routeCache = routeCache; this.trie = trie; this.BuildTrie(); }
/// <summary> /// Initializes a new instance of the RouteCacheFixture class. /// </summary> public RouteCacheFixture() { this.routeDescriptionProvider = A.Fake<IRouteDescriptionProvider>(); this.routeSegmentExtractor = A.Fake<IRouteSegmentExtractor>(); this.fakeModuleCatalog = new FakeModuleCatalog(); this.routeCache = new RouteCache(this.fakeModuleCatalog, A.Fake<INancyContextFactory>(), this.routeSegmentExtractor, this.routeDescriptionProvider, A.Fake<ICultureService>()); }
/// <summary> /// Initializes a new instance of the RouteCacheFixture class. /// </summary> public RouteCacheFixture() { this.routeDescriptionProvider = A.Fake <IRouteDescriptionProvider>(); this.routeSegmentExtractor = A.Fake <IRouteSegmentExtractor>(); this.fakeModuleCatalog = new FakeModuleCatalog(); this.routeCache = new RouteCache(this.fakeModuleCatalog, new FakeModuleKeyGenerator(), A.Fake <INancyContextFactory>(), this.routeSegmentExtractor, this.routeDescriptionProvider, A.Fake <ICultureService>()); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultRouteResolver"/> class, using /// the provided <paramref name="catalog"/>, <paramref name="moduleBuilder"/>, /// <paramref name="routeCache"/> and <paramref name="trie"/>. /// </summary> /// <param name="catalog">An <see cref="INancyModuleCatalog"/> instance.</param> /// <param name="moduleBuilder">An <see cref="INancyModuleBuilder"/> instance.</param> /// <param name="routeCache">An <see cref="IRouteCache"/> instance.</param> /// <param name="trie">An <see cref="IRouteResolverTrie"/> instance.</param> /// <param name="environment">An <see cref="INancyEnvironment"/> instance.</param> public DefaultRouteResolver(INancyModuleCatalog catalog, INancyModuleBuilder moduleBuilder, IRouteCache routeCache, IRouteResolverTrie trie, INancyEnvironment environment) { this.catalog = catalog; this.moduleBuilder = moduleBuilder; this.routeCache = routeCache; this.trie = trie; this.configuration = new Lazy<RouteConfiguration>(environment.GetValue<RouteConfiguration>); this.BuildTrie(); }
/// <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 RouteCacheFixture class. /// </summary> public RouteCacheFixture() { this.routeDescriptionProvider = A.Fake <IRouteDescriptionProvider>(); this.routeSegmentExtractor = A.Fake <IRouteSegmentExtractor>(); this.routeMetadataProviders = new IRouteMetadataProvider[0]; this.fakeModuleCatalog = new FakeModuleCatalog(); this.routeCache = new RouteCache(this.fakeModuleCatalog, A.Fake <INancyContextFactory>(), this.routeSegmentExtractor, this.routeDescriptionProvider, A.Fake <ICultureService>(), this.routeMetadataProviders); }
/// <summary> /// Initializes a new instance of the <see cref="RouteCache"/> class. /// </summary> /// <param name="moduleCatalog">The <see cref="INancyModuleCatalog"/> that should be used by the cache.</param> /// <param name="moduleKeyGenerator">The <see cref="IModuleKeyGenerator"/> used to generate module keys.</param> /// <param name="contextFactory">The <see cref="INancyContextFactory"/> that should be used to create a context instance.</param> /// <param name="routeSegmentExtractor"> </param> public RouteCache(INancyModuleCatalog moduleCatalog, IModuleKeyGenerator moduleKeyGenerator, INancyContextFactory contextFactory, IRouteSegmentExtractor routeSegmentExtractor, IRouteDescriptionProvider routeDescriptionProvider) { this.moduleKeyGenerator = moduleKeyGenerator; this.routeSegmentExtractor = routeSegmentExtractor; this.routeDescriptionProvider = routeDescriptionProvider; using (var context = contextFactory.Create()) { this.BuildCache(moduleCatalog.GetAllModules(context)); } }
/// <summary> /// Initializes a new instance of the <see cref="RouteCache"/> class. /// </summary> /// <param name="moduleCatalog">The <see cref="INancyModuleCatalog"/> that should be used by the cache.</param> /// <param name="contextFactory">The <see cref="INancyContextFactory"/> that should be used to create a context instance.</param> /// <param name="routeSegmentExtractor"> </param> public RouteCache(INancyModuleCatalog moduleCatalog, INancyContextFactory contextFactory, IRouteSegmentExtractor routeSegmentExtractor, IRouteDescriptionProvider routeDescriptionProvider, ICultureService cultureService) { this.routeSegmentExtractor = routeSegmentExtractor; this.routeDescriptionProvider = routeDescriptionProvider; var request = new Request("GET", "/", "http"); using (var context = contextFactory.Create(request)) { this.BuildCache(moduleCatalog.GetAllModules(context)); } }
public Routes(INancyModuleCatalog catalog) { this.catalog = catalog; }
public SwaggerAnnotationsProvider(INancyModuleCatalog moduleCatalog, NancyContext context) { _moduleCatalog = moduleCatalog; _context = context; }
public SwaggerAnnotationsProvider(INancyModuleCatalog moduleCatalog, ISwaggerModelCatalog modelCatalog, ISwaggerTagCatalog tagCatalog) { _moduleCatalog = moduleCatalog; _modelCatalog = modelCatalog; _tagCatalog = tagCatalog; }
/// <summary> /// Initializes a new instance of the RouteResolver class. /// </summary> /// <param name="routeCache">Route cache provider</param> /// <param name="moduleCatalog">Module catalog</param> /// <param name="templateSelector">Template selector</param> public DefaultRouteResolver(IRouteCache routeCache, INancyModuleCatalog moduleCatalog, ITemplateEngineSelector templateSelector) { _RouteCache = routeCache; _ModuleCatalog = moduleCatalog; _TemplateSelector = templateSelector; }
public Bootstrapper(INancyModule interactiveModule) { _moduleCatalog = new ModuleCatalog(interactiveModule); }
public HttpServiceNancyBootstrapper(INancyModuleCatalog nancyModuleCatalog) { _nancyModuleCatalog = nancyModuleCatalog; }
public ApiMetaDataGenerator(IRouteCacheProvider routeCacheProvider, IRouteMetadataProvider routeMetadataProvider, INancyModuleCatalog nancyModuleCatalog) { _routeCacheProvider = routeCacheProvider; _routeMetadataProvider = routeMetadataProvider; _nancyModuleCatalog = nancyModuleCatalog; }
public DefaultRouteResolver(INancyModuleCatalog nancyModuleCatalog, IRoutePatternMatcher routePatternMatcher, ITemplateEngineSelector templateEngineSelector) { this.nancyModuleCatalog = nancyModuleCatalog; this.routePatternMatcher = routePatternMatcher; this.templateEngineSelector = templateEngineSelector; }