Also test `string.Empty` model

This commit is contained in:
dougbu 2014-06-26 21:42:32 -07:00
parent 6eb1e38e33
commit bbf470bd34
2 changed files with 10 additions and 6 deletions

View File

@ -153,11 +153,13 @@ namespace Microsoft.AspNet.Mvc.Core.Test
Assert.Equal("Model string", result.ToString());
}
[Fact]
public void DisplayFor_FindsModel_EvenIfNull()
[Theory]
[InlineData(null)]
[InlineData("")]
public void DisplayFor_FindsModel_EvenIfNullOrEmpty(string propertyValue)
{
// Arrange
var model = new DefaultTemplatesUtilities.ObjectTemplateModel();
var model = new DefaultTemplatesUtilities.ObjectTemplateModel { Property1 = propertyValue, };
var viewEngine = new Mock<IViewEngine>();
viewEngine
.Setup(v => v.FindPartialView(It.IsAny<IDictionary<string, object>>(), It.IsAny<string>()))

View File

@ -167,11 +167,13 @@ Environment.NewLine;
result.ToString());
}
[Fact]
public void EditorFor_FindsModel_EvenIfNull()
[Theory]
[InlineData(null)]
[InlineData("")]
public void EditorFor_FindsModel_EvenIfNullOrEmpty(string propertyValue)
{
// Arrange
var model = new DefaultTemplatesUtilities.ObjectTemplateModel();
var model = new DefaultTemplatesUtilities.ObjectTemplateModel { Property1 = propertyValue, };
var viewEngine = new Mock<IViewEngine>();
viewEngine
.Setup(v => v.FindPartialView(It.IsAny<IDictionary<string, object>>(), It.IsAny<string>()))