public RouteResolverFixture() { this.templateEngineSelector = A.Fake<ITemplateEngineSelector>(); this.catalog = A.Fake<INancyModuleCatalog>(); A.CallTo(() => this.catalog.GetModuleByKey(A<string>.Ignored)).Returns(new FakeNancyModule()); this.expectedAction = x => HttpStatusCode.OK; this.expectedModule = new FakeNancyModule(x => { x.AddGetRoute("/foo/bar", this.expectedAction); }); A.CallTo(() => this.catalog.GetModuleByKey(A<string>.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.templateEngineSelector); }
public DefaultRouteResolver(INancyModuleCatalog nancyModuleCatalog, IRoutePatternMatcher routePatternMatcher, ITemplateEngineSelector templateEngineSelector) { this.nancyModuleCatalog = nancyModuleCatalog; this.routePatternMatcher = routePatternMatcher; this.templateEngineSelector = templateEngineSelector; }
/// <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; }