diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/JsonOutputFormatterTests.cs b/test/Microsoft.AspNet.Mvc.FunctionalTests/JsonOutputFormatterTests.cs index 55f8c7b7aa..2af52a2c22 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/JsonOutputFormatterTests.cs +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/JsonOutputFormatterTests.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; using System.Net; using System.Net.Http; using System.Net.Http.Headers; @@ -72,7 +73,21 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests // Assert Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); - Assert.Equal(expectedOutput, await response.Content.ReadAsStringAsync()); + + var actualContent = await response.Content.ReadAsStringAsync(); + Assert.Equal(expectedOutput, actualContent); + + var modelStateErrors = JsonConvert.DeserializeObject>(actualContent); + Assert.Equal(2, modelStateErrors.Count); + + var errors = Assert.Single(modelStateErrors, kvp => kvp.Key == "Id").Value; + + var error = Assert.Single(errors); + Assert.Equal("The field Id must be between 10 and 100.", error); + + errors = Assert.Single(modelStateErrors, kvp => kvp.Key == "Name").Value; + error = Assert.Single(errors); + Assert.Equal("The field Name must be a string or array type with a minimum length of '15'.", error); } } } \ No newline at end of file