Example #1
0
        /// <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);
        }
Example #2
0
        /// <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);
        }
Example #3
0
        /// <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>());
        }
Example #4
0
        /// <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>());
        }
Example #5
0
        /// <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);
        }
Example #6
0
        /// <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)
        {
            this.moduleKeyGenerator    = moduleKeyGenerator;
            this.routeSegmentExtractor = routeSegmentExtractor;

            using (var context = contextFactory.Create())
            {
                this.BuildCache(moduleCatalog.GetAllModules(context));
            }
        }
Example #7
0
        /// <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));
            }
        }
Example #8
0
 public ResourceLinker(IRouteCacheProvider routesProvider, IRouteSegmentExtractor extractor, IUriFilter queryFilter)
 {
   this.routesProvider = routesProvider;
   this.segmentExtractor = extractor;
   this.uriFilter = queryFilter;
 }