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> /// <summary>
/// Creates a <see cref="RazorView"/> providing it with the <see cref="IRazorPage"/> to execute. /// Creates a <see cref="RazorView"/> providing it with the <see cref="IRazorPage"/> to execute.
/// </summary> /// </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> /// <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); IView GetView([NotNull] IRazorPage page, bool isPartial);
} }
} }

View File

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