Enabling test for 2447, CancellationToken does not gets validated.

This commit is contained in:
Harsh Gupta 2015-06-01 12:05:09 -07:00
parent e31eab0391
commit 386562c269
2 changed files with 11 additions and 31 deletions

View File

@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Mvc.IntegrationTests
public byte[] Token { get; set; }
}
[Theory(Skip = "ModelState.Value not set due to #2445, #2447")]
[Theory(Skip = "ModelState.Value not set due to #2445")]
[InlineData(true)]
[InlineData(false)]
public async Task BindProperty_WithData_GetsBound(bool fallBackScenario)
@ -68,12 +68,12 @@ namespace Microsoft.AspNet.Mvc.IntegrationTests
var key = Assert.Single(modelState.Keys, k => k == queryStringKey + "[0]");
Assert.NotNull(modelState[key].Value); // should be non null bug #2445.
Assert.Empty(modelState[key].Errors);
Assert.Equal(ModelValidationState.Valid, modelState[key].ValidationState); // Should be skipped. bug#2447
Assert.Equal(ModelValidationState.Valid, modelState[key].ValidationState);
key = Assert.Single(modelState.Keys, k => k == queryStringKey + "[1]");
Assert.NotNull(modelState[key].Value); // should be non null bug #2445.
Assert.Empty(modelState[key].Errors);
Assert.Equal(ModelValidationState.Valid, modelState[key].ValidationState); // Should be skipped. bug#2447
Assert.Equal(ModelValidationState.Valid, modelState[key].ValidationState);
}
[Fact]

View File

@ -19,8 +19,8 @@ namespace Microsoft.AspNet.Mvc.IntegrationTests
public CancellationToken Token { get; set; }
}
[Fact(Skip = "CancellationToken should not be validated #2447.")]
public async Task BindProperty_WithData__WithPrefix_GetsBound()
[Fact]
public async Task BindProperty_WithData_WithPrefix_GetsBound()
{
// Arrange
var argumentBinder = ModelBindingTestHelper.GetArgumentBinder();
@ -55,19 +55,11 @@ namespace Microsoft.AspNet.Mvc.IntegrationTests
// ModelState
Assert.True(modelState.IsValid);
Assert.Equal(2, modelState.Keys.Count);
Assert.Single(modelState.Keys, k => k == "CustomParameter");
var key = Assert.Single(modelState.Keys, k => k == "CustomParameter.Token");
Assert.Null(modelState[key].Value);
Assert.Empty(modelState[key].Errors);
// This Assert Fails.
Assert.Equal(ModelValidationState.Skipped, modelState[key].ValidationState);
Assert.Equal(0, modelState.Keys.Count);
}
[Fact(Skip = "CancellationToken should not be validated #2447")]
public async Task BindProperty_WithData__WithEmptyPrefix_GetsBound()
[Fact]
public async Task BindProperty_WithData_WithEmptyPrefix_GetsBound()
{
// Arrange
var argumentBinder = ModelBindingTestHelper.GetArgumentBinder();
@ -97,16 +89,10 @@ namespace Microsoft.AspNet.Mvc.IntegrationTests
// ModelState
Assert.True(modelState.IsValid);
var key = Assert.Single(modelState.Keys);
Assert.Equal("Token", key);
Assert.Null(modelState[key].Value);
Assert.Empty(modelState[key].Errors);
// This Assert Fails.
Assert.Equal(ModelValidationState.Skipped, modelState[key].ValidationState);
Assert.Equal(0, modelState.Count);
}
[Fact(Skip = "CancellationToken should not be validated #2447.")]
[Fact]
public async Task BindParameter_WithData_GetsBound()
{
// Arrange
@ -140,13 +126,7 @@ namespace Microsoft.AspNet.Mvc.IntegrationTests
// ModelState
Assert.True(modelState.IsValid);
var key = Assert.Single(modelState.Keys);
Assert.Equal("CustomParameter", key);
Assert.Null(modelState[key].Value);
Assert.Empty(modelState[key].Errors);
// This assert fails.
Assert.Equal(ModelValidationState.Skipped, modelState[key].ValidationState);
Assert.Equal(0, modelState.Count);
}
}
}