Updating the summary comment for IRazorViewFactory and its tests per comments

This commit is contained in:
ianhong 2014-11-12 17:12:28 -08:00
parent 0720177243
commit 245d1dffda
2 changed files with 9 additions and 27 deletions

View File

@ -13,9 +13,9 @@ namespace Microsoft.AspNet.Mvc.Razor
/// <summary>
/// Creates a <see cref="RazorView"/> providing it with the <see cref="IRazorPage"/> to execute.
/// </summary>
/// <param name="razorPage">The <see cref="IRazorPage"/> instance to execute.</param>
/// <param name="page">The <see cref="IRazorPage"/> instance to execute.</param>
/// <param name="isPartial">Determines if the view is to be executed as a partial.</param>
/// <returns>The IRazorPage instance if it exists, null otherwise.</returns>
/// <returns>A <see cref="IView"/> instance that renders the contents of the specified <paramref name="page"/></returns>
IView GetView([NotNull] IRazorPage page, bool isPartial);
}
}

View File

@ -15,8 +15,10 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
public class RazorViewFactoryTest
{
[Fact]
public void GetView_SetsIsPartial()
[Theory]
[InlineData(false)]
[InlineData(true)]
public void GetView_SetsIsPartial(bool isPartial)
{
// Arrange
var factory = new RazorViewFactory(
@ -25,14 +27,11 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
Mock.Of<IViewStartProvider>());
// Act
var viewPartial = factory.GetView(Mock.Of<IRazorPage>(), isPartial: true) as RazorView;
var view = factory.GetView(Mock.Of<IRazorPage>(), isPartial: false) as RazorView;
var view = factory.GetView(Mock.Of<IRazorPage>(), isPartial);
// Assert
Assert.NotNull(viewPartial);
Assert.True(viewPartial.IsPartial);
Assert.NotNull(view);
Assert.True(!view.IsPartial);
var razorView = Assert.IsType<RazorView>(view);
Assert.Equal(razorView.IsPartial, isPartial);
}
[Fact]
@ -53,22 +52,5 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
Assert.NotNull(view);
Assert.Same(view.RazorPage, page);
}
[Fact]
public void GetView_ReturnsRazorView()
{
// Arrange
var factory = new RazorViewFactory(
Mock.Of<IRazorPageFactory>(),
Mock.Of<IRazorPageActivator>(),
Mock.Of<IViewStartProvider>());
// Act
var view = factory.GetView(Mock.Of<IRazorPage>(), isPartial: true);
// Assert
Assert.IsType<RazorView>(view);
}
}
}