public void Should_provide_list_of_inspected_view_locations_in_not_found_exception() { var viewEngines = new[] { A.Fake<IViewEngine>(), A.Fake<IViewEngine>(), }; A.CallTo(() => viewEngines[0].Extensions).Returns(new[] { "html" }); A.CallTo(() => viewEngines[1].Extensions).Returns(new[] { "sshtml" }); var conventions = new Func<string, dynamic, ViewLocationContext, string>[] {(a,b,c) => "baz"}; var factory = new DefaultViewFactory(this.resolver, viewEngines, this.renderContextFactory, new ViewLocationConventions(conventions), this.rootPathProvider); A.CallTo(() => this.resolver.GetViewLocation(A<string>.Ignored, A<object>.Ignored, A<ViewLocationContext>.Ignored)).Returns(null); var result = (Record.Exception(() => factory.RenderView("foo", null, this.viewLocationContext))) as ViewNotFoundException; result.AvailableViewEngineExtensions.ShouldEqualSequence(new[] { "html", "sshtml" }); result.ViewName.ShouldEqual("foo"); result.InspectedLocations.ShouldEqualSequence(new [] {"baz"}); }
/// <summary> /// Creates the view based on the view factory sent to the constructor /// </summary> /// <param name="viewFactory">the view factory that is decorated</param> public TestingViewFactory(DefaultViewFactory viewFactory) { this.decoratedViewFactory = viewFactory; }
public TestingViewFactory(DefaultViewFactory defaultViewFactory) { _defaultViewFactory = defaultViewFactory; }
public ConfigurableModelViewFactory(IViewResolver viewResolver, IEnumerable<IViewEngine> viewEngines, IRenderContextFactory renderContextFactory) { _viewFactory = new DefaultViewFactory(viewResolver, viewEngines, renderContextFactory); }