Updating FindView_UsesViewLocationExpandersToLocateViews for IRazorViewFactory.

This commit is contained in:
ianhong 2014-11-11 15:57:08 -08:00
parent e9c7a34cfc
commit 23a7aa813d
1 changed files with 9 additions and 5 deletions

View File

@ -302,7 +302,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
};
}
}
/*
[Theory]
[MemberData(nameof(FindView_UsesViewLocationExpandersToLocateViewsData))]
public void FindView_UsesViewLocationExpandersToLocateViews(IDictionary<string, object> routeValues,
@ -314,6 +314,10 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
.Returns(Mock.Of<IRazorPage>())
.Verifiable();
var viewFactory = new Mock<IRazorViewFactory>();
viewFactory.Setup(p => p.GetView(It.IsAny<IRazorPage>(), It.IsAny<bool>()))
.Returns(Mock.Of<IView>());
var expander1Result = new[] { "some-seed" };
var expander1 = new Mock<IViewLocationExpander>();
expander1.Setup(e => e.PopulateValues(It.IsAny<ViewLocationExpanderContext>()))
@ -343,21 +347,21 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
.Returns(new[] { "test-string/{1}.cshtml" })
.Verifiable();
var viewEngine = CreateViewEngine(pageFactory.Object,
var viewEngine = CreateViewEngine(pageFactory.Object, viewFactory.Object,
new[] { expander1.Object, expander2.Object });
var context = GetActionContext(routeValues);
var context = GetActionContext(routeValues, viewFactory.Object);
// Act
var result = viewEngine.FindView(context, "test-view");
// Assert
Assert.True(result.Success);
Assert.IsAssignableFrom<IRazorView>(result.View);
Assert.IsAssignableFrom<RazorView>(result.View);
pageFactory.Verify();
expander1.Verify();
expander2.Verify();
}
*/
[Fact]
public void FindView_CachesValuesIfViewWasFound()
{