Minor test code changes to resolve xUnit2013 build error

This commit is contained in:
Nate McMaster 2017-10-05 16:04:20 -07:00
Родитель d0a8b5f78f
Коммит 3f02482617
16 изменённых файлов: 78 добавлений и 78 удалений

Просмотреть файл

@ -119,7 +119,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
dictionary.Clear();
// Assert
Assert.Equal(0, dictionary.Count);
Assert.Empty(dictionary);
Assert.Equal(0, dictionary.ErrorCount);
Assert.Empty(dictionary);
Assert.Equal(ModelValidationState.Valid, dictionary.ValidationState);
@ -135,7 +135,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
dictionary.Clear();
// Assert
Assert.Equal(0, dictionary.Count);
Assert.Empty(dictionary);
Assert.Equal(0, dictionary.ErrorCount);
Assert.Empty(dictionary);
Assert.Equal(ModelValidationState.Valid, dictionary.ValidationState);
@ -180,7 +180,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
// Assert
Assert.Equal(0, source.ErrorCount);
Assert.Equal(1, source.Count);
Assert.Single(source);
Assert.Equal(ModelValidationState.Skipped, source["key"].ValidationState);
}
@ -239,7 +239,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
// Assert
Assert.Equal(0, source.ErrorCount);
Assert.Equal(1, source.Count);
Assert.Single(source);
Assert.Equal(ModelValidationState.Valid, source["key"].ValidationState);
}
@ -276,7 +276,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
// Assert
Assert.Equal(2, target.ErrorCount);
Assert.Equal(1, target.Count);
Assert.Single(target);
var actual = target["key"];
Assert.Equal(entry.RawValue, actual.RawValue);
Assert.Equal(entry.AttemptedValue, actual.AttemptedValue);

Просмотреть файл

@ -2751,7 +2751,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Test
// Assert
Assert.False(result);
Assert.Equal(1, controller.ModelState.Count);
Assert.Single(controller.ModelState);
var error = Assert.Single(controller.ModelState["Prefix.IntegerProperty"].Errors);
Assert.Equal("Out of range!", error.ErrorMessage);
}
@ -2787,7 +2787,7 @@ namespace Microsoft.AspNetCore.Mvc.Core.Test
// Assert
Assert.False(result);
Assert.Equal(1, controller.ModelState.Count);
Assert.Single(controller.ModelState);
var error = Assert.Single(controller.ModelState["IntegerProperty"].Errors);
Assert.Equal("Out of range!", error.ErrorMessage);
}

Просмотреть файл

@ -614,7 +614,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal
// Assert
Assert.True(modelState.IsValid);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
var entry = modelState["parameter"];
Assert.Equal(ModelValidationState.Valid, entry.ValidationState);

Просмотреть файл

@ -664,7 +664,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders
// Assert
var modelStateDictionary = bindingContext.ModelState;
Assert.False(modelStateDictionary.IsValid);
Assert.Equal(1, modelStateDictionary.Count);
Assert.Single(modelStateDictionary);
// Check Age error.
ModelStateEntry entry;

Просмотреть файл

@ -578,7 +578,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Null(boundPerson.Address);
Assert.False(modelState.IsValid);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
var state = modelState["CustomParameter.Address.Number"];

Просмотреть файл

@ -92,7 +92,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
// ModelState
Assert.True(modelState.IsValid);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
}
[Fact]
@ -130,7 +130,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
// ModelState
Assert.True(modelState.IsValid);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
}
}
}

Просмотреть файл

@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.NotNull(model.Customer.Address);
Assert.Equal(AddressStreetContent, model.Customer.Address.Street);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -122,7 +122,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.NotNull(model.Customer.Address);
Assert.Equal(AddressStreetContent, model.Customer.Address.Street);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -167,7 +167,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Equal("bill", model.Customer.Name);
Assert.Null(model.Customer.Address);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -209,7 +209,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Null(model.Customer);
Assert.Equal(10, model.ProductId);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -250,7 +250,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order1>(modelBindingResult.Model);
Assert.Null(model.Customer);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -389,7 +389,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Equal("bill", model.Customer.Name);
Assert.Null(model.Customer.Token);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -578,7 +578,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Null(model.Customer);
Assert.Equal(10, model.ProductId);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -619,7 +619,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order4>(modelBindingResult.Model);
Assert.Null(model.Customer);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -756,7 +756,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Equal("bill", model.Name);
Assert.Null(model.ProductIds);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -795,7 +795,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Null(model.Name);
Assert.Null(model.ProductIds);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -932,7 +932,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Equal("bill", model.Name);
Assert.Null(model.ProductIds);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -971,7 +971,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Null(model.Name);
Assert.Null(model.ProductIds);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -1108,7 +1108,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Equal("bill", model.Name);
Assert.Null(model.ProductIds);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -1147,7 +1147,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Null(model.Name);
Assert.Null(model.ProductIds);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -1609,7 +1609,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Equal("bill", model.Name);
Assert.Equal(default(KeyValuePair<string, int>), model.ProductId);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -1648,7 +1648,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Null(model.Name);
Assert.Equal(default(KeyValuePair<string, int>), model.ProductId);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -1784,7 +1784,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.NotNull(model.Customer.Address);
Assert.Equal(AddressStreetContent, model.Customer.Address.Street);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -1826,7 +1826,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order10>(modelBindingResult.Model);
Assert.Null(model.Customer);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);
@ -1873,7 +1873,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order10>(modelBindingResult.Model);
Assert.Null(model.Customer);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);
@ -2074,7 +2074,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order12>(modelBindingResult.Model);
Assert.Null(model.ProductName);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);
@ -2118,7 +2118,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order12>(modelBindingResult.Model);
Assert.Null(model.ProductName);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);
@ -2158,7 +2158,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order12>(modelBindingResult.Model);
Assert.Equal("abc", model.ProductName);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -2202,7 +2202,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order13>(modelBindingResult.Model);
Assert.Null(model.OrderIds);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);
@ -2246,7 +2246,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order13>(modelBindingResult.Model);
Assert.Null(model.OrderIds);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);
@ -2286,7 +2286,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order13>(modelBindingResult.Model);
Assert.Equal(new[] { 123 }, model.OrderIds.ToArray());
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -2332,7 +2332,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.NotNull(model);
Assert.Equal(0, model.ProductId);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);

Просмотреть файл

@ -219,7 +219,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Single(model);
Assert.NotNull(model[0]);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -253,7 +253,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Single(model);
Assert.Null(model[0]);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -378,7 +378,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.NotNull(model);
Assert.Empty(model);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -501,7 +501,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.NotNull(model);
Assert.Empty(model);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -633,7 +633,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.NotNull(model);
Assert.Empty(model);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}

Просмотреть файл

@ -332,7 +332,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Equal(new KeyValuePair<string, int>(), modelBindingResult.Model);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -495,7 +495,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Equal(new KeyValuePair<string, Person>(), modelBindingResult.Model);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}

Просмотреть файл

@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Person1>(modelBindingResult.Model);
Assert.Null(model.Name);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -104,7 +104,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Person2>(modelBindingResult.Model);
Assert.Null(model.Name);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -143,7 +143,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Person3>(modelBindingResult.Model);
Assert.Null(model.Name);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -192,7 +192,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Person4>(modelBindingResult.Model);
Assert.Null(model.Name);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -238,7 +238,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Person5>(modelBindingResult.Model);
Assert.Null(model.Name);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}

Просмотреть файл

@ -274,7 +274,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
// ModelState
Assert.False(modelState.IsValid);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
var key = Assert.Single(modelState.Keys);
@ -332,7 +332,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
// ModelState
Assert.False(modelState.IsValid);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
var key = Assert.Single(modelState.Keys);

Просмотреть файл

@ -187,7 +187,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order1>(modelBindingResult.Model);
Assert.Equal("bill", model.CustomerName);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -224,7 +224,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order1>(modelBindingResult.Model);
Assert.Null(model.CustomerName);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);
@ -276,7 +276,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.NotNull(model.Customer);
Assert.Equal("bill", model.Customer.Name);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -313,7 +313,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order2>(modelBindingResult.Model);
Assert.Null(model.Customer);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);
@ -367,7 +367,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.NotNull(model.Customer);
Assert.Equal("bill", model.Customer.Name);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -459,7 +459,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.NotNull(model.Items);
Assert.Equal(17, Assert.Single(model.Items).ItemId);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -497,7 +497,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order4>(modelBindingResult.Model);
Assert.Null(model.Items);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);
@ -545,7 +545,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<List<Order5>>(modelBindingResult.Model);
Assert.Equal(17, Assert.Single(model).ProductId);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -631,7 +631,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order6>(modelBindingResult.Model);
Assert.Equal("bill", model.Name);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -668,7 +668,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order6>(modelBindingResult.Model);
Assert.Equal("billybob", model.Name);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);
@ -719,7 +719,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order7>(modelBindingResult.Model);
Assert.Equal("bill", model.Customer.Name);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -756,7 +756,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order7>(modelBindingResult.Model);
Assert.Equal("billybob", model.Customer.Name);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);
@ -796,7 +796,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order7>(modelBindingResult.Model);
Assert.Null(model.Customer);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -854,7 +854,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order8>(modelBindingResult.Model);
Assert.Equal("bill", model.Customer.Name);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -961,7 +961,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<Order9>(modelBindingResult.Model);
Assert.Equal("bill", Assert.Single(model.Products).Name);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -1049,7 +1049,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<List<Order10>>(modelBindingResult.Model);
Assert.Equal("bill", Assert.Single(model).Name);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
@ -1086,7 +1086,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<List<Order10>>(modelBindingResult.Model);
Assert.Equal("billybob", Assert.Single(model).Name);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
Assert.Equal(1, modelState.ErrorCount);
Assert.False(modelState.IsValid);
@ -1126,7 +1126,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
var model = Assert.IsType<List<Order10>>(modelBindingResult.Model);
Assert.Empty(model);
Assert.Equal(0, modelState.Count);
Assert.Empty(modelState);
Assert.Equal(0, modelState.ErrorCount);
Assert.True(modelState.IsValid);
}
@ -1690,7 +1690,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Equal("Hello", message);
Assert.True(modelState.IsValid);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
var entry = Assert.Single(modelState, kvp => kvp.Key == "CustomParameter.message");
Assert.Equal(ModelValidationState.Skipped, entry.Value.ValidationState);
@ -1732,7 +1732,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.IsType<CancellationToken>(modelBindingResult.Model);
Assert.False(modelState.IsValid);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
var entry = Assert.Single(modelState, kvp => kvp.Key == "message");
Assert.Equal(ModelValidationState.Unvalidated, entry.Value.ValidationState);
@ -1778,7 +1778,7 @@ namespace Microsoft.AspNetCore.Mvc.IntegrationTests
Assert.Equal("Hello", message);
Assert.False(modelState.IsValid);
Assert.Equal(1, modelState.Count);
Assert.Single(modelState);
var entry = Assert.Single(modelState, kvp => kvp.Key == "other.key");
Assert.Equal(ModelValidationState.Unvalidated, entry.Value.ValidationState);

Просмотреть файл

@ -79,7 +79,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
attributes.Clear();
// Assert
Assert.Equal(0, attributes.Count);
Assert.Empty(attributes);
Assert.Empty(attributes);
}

Просмотреть файл

@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
Assert.NotNull(viewData.TemplateInfo);
Assert.Null(viewData.Model);
Assert.NotNull(viewData.ModelMetadata);
Assert.Equal(0, viewData.Count);
Assert.Empty(viewData);
}
[Fact]

Просмотреть файл

@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
Assert.NotNull(viewData.TemplateInfo);
Assert.Null(viewData.Model);
Assert.NotNull(viewData.ModelMetadata);
Assert.Equal(0, viewData.Count);
Assert.Empty(viewData);
}
[Fact]
@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
Assert.NotNull(viewData.TemplateInfo);
Assert.Null(viewData.Model);
Assert.NotNull(viewData.ModelMetadata);
Assert.Equal(0, viewData.Count);
Assert.Empty(viewData);
}
[Fact]

Просмотреть файл

@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
// Act & Assert
Assert.Empty(viewData);
Assert.Equal(0, viewData.Count);
Assert.Empty(viewData);
Assert.False(viewData.IsReadOnly);
Assert.NotNull(viewData.Keys);