/// <summary> /// Initializes a new instance of the <see cref="DefaultViewFactory"/> class. /// </summary> /// <param name="viewResolver">An <see cref="IViewResolver"/> instance that should be used to resolve the location of a view.</param> /// <param name="viewEngines">An <see cref="IEnumerable{T}"/> instance containing the <see cref="IViewEngine"/> instances that should be able to be used to render a view</param> /// <param name="renderContextFactory">A <see cref="IRenderContextFactory"/> instance that should be used to create an <see cref="IRenderContext"/> when a view is rendered.</param> /// <param name="conventions">An <see cref="ViewLocationConventions"/> instance that should be used to resolve all possible view locations </param> /// <param name="rootPathProvider">An <see cref="IRootPathProvider"/> instance.</param> public DefaultViewFactory(IViewResolver viewResolver, IEnumerable<IViewEngine> viewEngines, IRenderContextFactory renderContextFactory, ViewLocationConventions conventions, IRootPathProvider rootPathProvider) { this.viewResolver = viewResolver; this.viewEngines = viewEngines; this.renderContextFactory = renderContextFactory; this.conventions = conventions; this.rootPathProvider = rootPathProvider; this.viewEngineExtensions = this.viewEngines.SelectMany(ive => ive.Extensions).ToArray(); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultViewFactory"/> class. /// </summary> /// <param name="viewResolver">An <see cref="IViewResolver"/> instance that should be used to resolve the location of a view.</param> /// <param name="viewEngines">An <see cref="IEnumerable{T}"/> instance containing the <see cref="IViewEngine"/> instances that should be able to be used to render a view</param> /// <param name="renderContextFactory">A <see cref="IRenderContextFactory"/> instance that should be used to create an <see cref="IRenderContext"/> when a view is rendered.</param> /// <param name="conventions">An <see cref="ViewLocationConventions"/> instance that should be used to resolve all possible view locations </param> /// <param name="rootPathProvider">An <see cref="IRootPathProvider"/> instance.</param> public DefaultViewFactory(IViewResolver viewResolver, IEnumerable <IViewEngine> viewEngines, IRenderContextFactory renderContextFactory, ViewLocationConventions conventions, IRootPathProvider rootPathProvider) { this.viewResolver = viewResolver; this.viewEngines = viewEngines; this.renderContextFactory = renderContextFactory; this.conventions = conventions; this.rootPathProvider = rootPathProvider; this.viewEngineExtensions = this.viewEngines.SelectMany(ive => ive.Extensions).ToArray(); }
public DefaultViewFactoryFixture() { this.resolver = A.Fake<IViewResolver>(); this.renderContextFactory = A.Fake<IRenderContextFactory>(); this.conventions = new ViewLocationConventions(Enumerable.Empty<Func<string, object, ViewLocationContext, string>>()); this.viewLocationContext = new ViewLocationContext { Context = new NancyContext() }; }
public DefaultViewFactoryFixture() { this.rootPathProvider = A.Fake <IRootPathProvider>(); A.CallTo(() => this.rootPathProvider.GetRootPath()).Returns("The root path"); this.resolver = A.Fake <IViewResolver>(); this.renderContextFactory = A.Fake <IRenderContextFactory>(); this.conventions = new ViewLocationConventions(Enumerable.Empty <Func <string, object, ViewLocationContext, string> >()); this.viewLocationContext = new ViewLocationContext { Context = new NancyContext() }; }
public DefaultViewFactoryFixture() { this.rootPathProvider = A.Fake<IRootPathProvider>(); A.CallTo(() => this.rootPathProvider.GetRootPath()).Returns("The root path"); this.resolver = A.Fake<IViewResolver>(); this.renderContextFactory = A.Fake<IRenderContextFactory>(); this.conventions = new ViewLocationConventions(Enumerable.Empty<Func<string, object, ViewLocationContext, string>>()); this.viewLocationContext = new ViewLocationContext { Context = new NancyContext() }; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultViewResolver"/> class. /// </summary> /// <param name="viewLocator">The view locator that should be used to locate views.</param> /// <param name="conventions">The conventions that the view resolver should use to figure out where to look for views.</param> public DefaultViewResolver(IViewLocator viewLocator, ViewLocationConventions conventions) { if (viewLocator == null) { throw new InvalidOperationException("Cannot create an instance of DefaultViewResolver with view locator parameter having null value."); } if (conventions == null) { throw new InvalidOperationException("Cannot create an instance of DefaultViewResolver with conventions parameter having null value."); } this.viewLocator = viewLocator; this.conventions = conventions; }