Also test `string.Empty` model
This commit is contained in:
parent
6eb1e38e33
commit
bbf470bd34
|
|
@ -153,11 +153,13 @@ namespace Microsoft.AspNet.Mvc.Core.Test
|
||||||
Assert.Equal("Model string", result.ToString());
|
Assert.Equal("Model string", result.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Theory]
|
||||||
public void DisplayFor_FindsModel_EvenIfNull()
|
[InlineData(null)]
|
||||||
|
[InlineData("")]
|
||||||
|
public void DisplayFor_FindsModel_EvenIfNullOrEmpty(string propertyValue)
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var model = new DefaultTemplatesUtilities.ObjectTemplateModel();
|
var model = new DefaultTemplatesUtilities.ObjectTemplateModel { Property1 = propertyValue, };
|
||||||
var viewEngine = new Mock<IViewEngine>();
|
var viewEngine = new Mock<IViewEngine>();
|
||||||
viewEngine
|
viewEngine
|
||||||
.Setup(v => v.FindPartialView(It.IsAny<IDictionary<string, object>>(), It.IsAny<string>()))
|
.Setup(v => v.FindPartialView(It.IsAny<IDictionary<string, object>>(), It.IsAny<string>()))
|
||||||
|
|
|
||||||
|
|
@ -167,11 +167,13 @@ Environment.NewLine;
|
||||||
result.ToString());
|
result.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Theory]
|
||||||
public void EditorFor_FindsModel_EvenIfNull()
|
[InlineData(null)]
|
||||||
|
[InlineData("")]
|
||||||
|
public void EditorFor_FindsModel_EvenIfNullOrEmpty(string propertyValue)
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var model = new DefaultTemplatesUtilities.ObjectTemplateModel();
|
var model = new DefaultTemplatesUtilities.ObjectTemplateModel { Property1 = propertyValue, };
|
||||||
var viewEngine = new Mock<IViewEngine>();
|
var viewEngine = new Mock<IViewEngine>();
|
||||||
viewEngine
|
viewEngine
|
||||||
.Setup(v => v.FindPartialView(It.IsAny<IDictionary<string, object>>(), It.IsAny<string>()))
|
.Setup(v => v.FindPartialView(It.IsAny<IDictionary<string, object>>(), It.IsAny<string>()))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue