527 references to Errors
FormatterWebSite (7)
Controllers\ValidationController.cs (5)
16return Content(ModelState["Id"].Errors[0].ErrorMessage + "," + 17ModelState["Name"].Errors[0].ErrorMessage + "," + 18ModelState["Alias"].Errors[0].ErrorMessage + "," + 19ModelState["Designation"].Errors[0].ErrorMessage); 53return ModelState["Name"].Errors[0].ErrorMessage;
ValidateBodyParameterAttribute.cs (2)
24var parameterBindingErrors = context.ModelState[bodyParameter.Name]?.Errors ?? 25context.ModelState[string.Empty]?.Errors;
Microsoft.AspNetCore.Mvc.Abstractions (16)
ModelBinding\ModelStateDictionary.cs (16)
190/// Adds the specified <paramref name="exception"/> to the <see cref="ModelStateEntry.Errors"/> instance 230/// Adds the specified <paramref name="exception"/> to the <see cref="ModelStateEntry.Errors"/> instance 249/// Attempts to add the specified <paramref name="exception"/> to the <see cref="ModelStateEntry.Errors"/> 317/// Adds the specified <paramref name="errorMessage"/> to the <see cref="ModelStateEntry.Errors"/> instance 333/// Attempts to add the specified <paramref name="errorMessage"/> to the <see cref="ModelStateEntry.Errors"/> 359modelState.Errors.Add(errorMessage); 456ErrorCount += source.Value.Errors.Count - target.Errors.Count; 522entry.Value.Errors.Clear(); 683modelState.Errors.Add(exception); 722ErrorCount -= node.Errors.Count; 856Errors.Clear(); 857for (var i = 0; i < entry.Errors.Count; i++) 859Errors.Add(entry.Errors[i]); 871Errors.Clear();
Microsoft.AspNetCore.Mvc.Abstractions.Test (62)
ModelBinding\ModelStateDictionaryTest.cs (62)
269entry.Errors.Add(new ModelError(new InvalidOperationException())); 270entry.Errors.Add(new ModelError("error-message")); 281Assert.Equal(entry.Errors, actual.Errors); 298var error = Assert.Single(kvp.Value.Errors); 315var error = Assert.Single(kvp.Value.Errors); 337Assert.Equal(2, kvp.Value.Errors.Count); 338Assert.Equal("some error", kvp.Value.Errors[0].ErrorMessage); 339Assert.Same(exception, kvp.Value.Errors[1].Exception); 573Assert.Collection(item.Errors, 601Assert.Empty(item.Errors); 606Assert.Collection(item.Errors, 638Assert.Empty(modelState.Errors); 658Assert.Single(modelState.Errors); 659Assert.Equal("some error", modelState.Errors[0].ErrorMessage); 769var error = Assert.Single(dictionary[string.Empty].Errors); 798var error = Assert.Single(dictionary[string.Empty].Errors); 839var error = Assert.Single(dictionary[string.Empty].Errors); 870var error = Assert.Single(dictionary[string.Empty].Errors); 875error = Assert.Single(dictionary["key3"].Errors); 903var error = Assert.Single(dictionary[string.Empty].Errors); 929var error = Assert.Single(copy[string.Empty].Errors); 969var error = Assert.Single(dictionary["key"].Errors); 986var error = Assert.Single(dictionary["key"].Errors); 1012var error = Assert.Single(entry.Value.Errors); 1040var error = Assert.Single(entry.Value.Errors); 1066var error = Assert.Single(entry.Value.Errors); 1082var error = Assert.Single(dictionary["key"].Errors); 1100var error = Assert.Single(dictionary["key"].Errors); 1127var error = Assert.Single(entry.Value.Errors); 1156var error = Assert.Single(entry.Value.Errors); 1183var error = Assert.Single(entry.Value.Errors); 1200var error = Assert.Single(dictionary["key"].Errors); 1218var error = Assert.Single(entry.Value.Errors); 1236var error = Assert.Single(entry.Value.Errors); 1256var error = Assert.Single(entry.Value.Errors); 1276var error = Assert.Single(entry.Value.Errors); 1296Assert.Empty(dictionary["Property1"].Errors); 1298Assert.Empty(dictionary["Property2"].Errors); 1300Assert.Single(dictionary["Property3"].Errors); 1302Assert.Empty(dictionary["Property4"].Errors); 1323Assert.Empty(dictionary["Product"].Errors); 1325Assert.Empty(dictionary["Product.Detail1"].Errors); 1327Assert.Empty(dictionary["Product.Detail2[0]"].Errors); 1329Assert.Empty(dictionary["Product.Detail2[1]"].Errors); 1331Assert.Empty(dictionary["Product.Detail2[2]"].Errors); 1333Assert.Empty(dictionary["Product.Detail3"].Errors); 1335Assert.Single(dictionary["ProductName"].Errors); 1354Assert.Empty(dictionary["Product.Detail1"].Errors); 1356Assert.Empty(dictionary["Product.Detail1.Name"].Errors); 1377Assert.Empty(dictionary["Property1"].Errors); 1379Assert.Empty(dictionary["Property2"].Errors); 1381Assert.Empty(dictionary["Property3"].Errors); 1383Assert.Empty(dictionary["Property4"].Errors); 1418Assert.Empty(entry.Value.Errors); 1426Assert.Empty(entry.Value.Errors); 1434Assert.Empty(entry.Value.Errors); 1442Assert.Collection(entry.Value.Errors, 1540Assert.Empty(value.Errors); 1547Assert.Empty(value.Errors); 1554Assert.Empty(value.Errors); 1562value.Errors,
Microsoft.AspNetCore.Mvc.Core (5)
ModelBinding\ModelBindingHelper.cs (2)
408kvp.Value.Errors.Clear(); 428entry.Errors.Clear();
ModelBinding\UnsupportedContentTypeFilter.cs (1)
45var errors = kvp.Value.Errors;
SerializableError.cs (1)
41var errors = keyModelStatePair.Value.Errors;
ValidationProblemDetails.cs (1)
42var errors = keyModelStatePair.Value.Errors;
Microsoft.AspNetCore.Mvc.Core.Test (181)
ControllerBaseTest.cs (3)
2711var error = Assert.Single(modelState.Value.Errors); 3117var error = Assert.Single(controller.ModelState["Prefix.IntegerProperty"].Errors); 3154var error = Assert.Single(controller.ModelState["IntegerProperty"].Errors);
Controllers\ControllerBinderDelegateProviderTest.cs (3)
419controllerContext.ModelState["memberName"].Errors.Single().ErrorMessage); 515controllerContext.ModelState["memberName"].Errors.Single().ErrorMessage); 1244var error = Assert.Single(entry.Value.Errors);
Formatters\JsonInputFormatterTestBase.cs (6)
330Assert.Single(kvp.Value.Errors); 356Assert.Single(kvp.Value.Errors); 409Assert.Single(kvp.Value.Errors); 435var error = Assert.Single(formatterContext.ModelState[""].Errors); 490Assert.Single(kvp.Value.Errors); 534Assert.Single(formatterContext.ModelState["Person.Name"].Errors);
Formatters\SystemTextJsonInputFormatterTest.cs (5)
84var error = Assert.Single(kvp.Value.Errors); 106var error = Assert.Single(kvp.Value.Errors); 127var error = Assert.Single(kvp.Value.Errors); 157var modelError = formatterContext.ModelState[modelStateKey].Errors.Single(); 179var modelError = formatterContext.ModelState["$"].Errors.Single();
Formatters\TextInputFormatterTest.cs (2)
35Assert.Single(context.ModelState["something"].Errors); 37var error = context.ModelState["something"].Errors[0];
ModelBinding\Binders\ArrayModelBinderTest.cs (1)
120var error = Assert.Single(keyValuePair.Value.Errors);
ModelBinding\Binders\BodyModelBinderTests.cs (17)
72Assert.Single(entry.Value.Errors); 97Assert.Single(entry.Value.Errors); 155Assert.Equal("Customized error message", entry.Value.Errors.Single().ErrorMessage); 243Assert.Single(bindingContext.ModelState[bindingContext.BinderModelName].Errors); 244Assert.Equal("Unsupported content type ''.", bindingContext.ModelState[bindingContext.BinderModelName].Errors[0].Exception.Message); 277var errorMessage = Assert.Single(entry.Value.Errors).ErrorMessage; 279Assert.Null(entry.Value.Errors[0].Exception); 320var errorMessage = Assert.Single(entry.Value.Errors).ErrorMessage; 322Assert.Null(entry.Value.Errors[0].Exception); 351Assert.NotEmpty(entry.Value.Errors[0].ErrorMessage); 391var errorMessage = Assert.Single(entry.Value.Errors).ErrorMessage; 393Assert.Null(entry.Value.Errors[0].Exception); 422Assert.NotEmpty(entry.Value.Errors[0].ErrorMessage); 423Assert.Null(entry.Value.Errors[0].Exception); 502var errorMessage = Assert.Single(entry.Value.Errors).Exception.Message; 504Assert.IsType<IOException>(entry.Value.Errors[0].Exception); 558var errorMessage = Assert.Single(entry.Value.Errors).Exception.Message;
ModelBinding\Binders\ByteArrayModelBinderTests.cs (1)
77var error = Assert.Single(bindingContext.ModelState["foo"].Errors);
ModelBinding\Binders\CollectionModelBinderTest.cs (1)
306var error = Assert.Single(keyValuePair.Value.Errors);
ModelBinding\Binders\ComplexObjectModelBinderTest.cs (9)
318var error = Assert.Single(keyValuePair.Value.Errors); 362var error = Assert.Single(keyValuePair.Value.Errors); 406var error = Assert.Single(keyValuePair.Value.Errors); 621var modelError = Assert.Single(entry.Errors); 686var modelError = Assert.Single(entry.Errors); 727var modelError = Assert.Single(entry.Errors); 1058bindingContext.ModelState["foo"].Errors[0].Exception.Message); 1079Assert.Single(bindingContext.ModelState["foo.NameNoAttribute"].Errors); 1081bindingContext.ModelState["foo.NameNoAttribute"].Errors[0].Exception.Message);
ModelBinding\Binders\ComplexTypeModelBinderTest.cs (9)
378var error = Assert.Single(keyValuePair.Value.Errors); 422var error = Assert.Single(keyValuePair.Value.Errors); 466var error = Assert.Single(keyValuePair.Value.Errors); 799var modelError = Assert.Single(entry.Errors); 833var modelError = Assert.Single(entry.Errors); 871var modelError = Assert.Single(entry.Errors); 1220bindingContext.ModelState["foo"].Errors[0].Exception.Message); 1241Assert.Single(bindingContext.ModelState["foo.NameNoAttribute"].Errors); 1243bindingContext.ModelState["foo.NameNoAttribute"].Errors[0].Exception.Message);
ModelBinding\Binders\DateTimeModelBinderTest.cs (3)
49var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 71var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 127var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
ModelBinding\Binders\DictionaryModelBinderTest.cs (1)
492var error = Assert.Single(keyValuePair.Value.Errors);
ModelBinding\Binders\EnumTypeModelBinderTest.cs (3)
43var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 148var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 231var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
ModelBinding\Binders\FloatingPointTypeModelBinderTestOfT.cs (6)
71var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 94var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 118var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 142var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 166var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 208var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
ModelBinding\Binders\HeaderModelBinderTests.cs (4)
294var error = Assert.Single(entry.Errors); 318Assert.Equal(2, entry.Errors.Count); 319Assert.Equal($"The value '{headerValues[0]}' is not valid.", entry.Errors[0].ErrorMessage); 320Assert.Equal($"The value '{headerValues[1]}' is not valid.", entry.Errors[1].ErrorMessage);
ModelBinding\Binders\KeyValuePairModelBinderTest.cs (2)
32var error = Assert.Single(bindingContext.ModelState["someName.Key"].Errors); 58var error = Assert.Single(state.Errors);
ModelBinding\Binders\SimpleTypeModelBinderTest.cs (4)
129var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 154var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 330var error = Assert.Single(entry.Value.Errors); 375var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
ModelBinding\Binders\TryParseTypeModelBinderTest.cs (6)
78var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 103var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 256var error = Assert.Single(entry.Value.Errors); 301var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 406var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors); 456var error = Assert.Single(bindingContext.ModelState["theModelName"].Errors);
ModelBinding\ModelBindingHelperTest.cs (15)
84var error = Assert.Single(modelState["MyProperty"].Errors); 654Assert.Empty(dictionary["Name"].Errors); 656Assert.Empty(dictionary["Id"].Errors); 658Assert.Empty(dictionary["Category"].Errors); 661Assert.Single(dictionary["Unrelated"].Errors); 683Assert.Empty(dictionary[string.Empty].Errors); 686Assert.Single(dictionary["Unrelated"].Errors); 714Assert.Empty(dictionary["[0].Name"].Errors); 716Assert.Empty(dictionary["[0].Id"].Errors); 718Assert.Empty(dictionary["[0].Category"].Errors); 720Assert.Empty(dictionary["[1].Name"].Errors); 722Assert.Empty(dictionary["[1].Id"].Errors); 724Assert.Empty(dictionary["[1].Category"].Errors); 727Assert.Single(dictionary["Unrelated"].Errors); 763Assert.Empty(dictionary[entry].Errors);
ModelBinding\ParameterBinderTest.cs (12)
82actionContext.ModelState.Single().Value.Errors.Single().ErrorMessage); 120actionContext.ModelState.Single().Value.Errors.Single().ErrorMessage); 219var error = Assert.Single(modelState.Value.Errors); 258actionContext.ModelState.Single().Value.Errors.Single().ErrorMessage); 299actionContext.ModelState.Single().Value.Errors.Single().ErrorMessage); 353var error = Assert.Single(kvp.Value.Errors); 408var error = Assert.Single(kvp.Value.Errors); 463var error = Assert.Single(kvp.Value.Errors); 517var error = Assert.Single(kvp.Value.Errors); 576var error = Assert.Single(kvp.Value.Errors); 637var error = Assert.Single(kvp.Value.Errors); 644var error = Assert.Single(kvp.Value.Errors);
ModelBinding\Validation\DefaultObjectValidatorTests.cs (68)
44Assert.Empty(entry.Errors); 71Assert.Empty(entry.Errors); 100Assert.Empty(entry.Errors); 127Assert.Empty(entry.Errors); 177Assert.Empty(entry.Errors); 181Assert.Empty(entry.Errors); 209Assert.Empty(entry.Errors); 213Assert.Empty(entry.Errors); 239var error = Assert.Single(entry.Errors); 244error = Assert.Single(entry.Errors); 282Assert.Empty(entry.Errors); 286Assert.Empty(entry.Errors); 315Assert.Equal(2, entry.Errors.Count); 316var errorMessages = entry.Errors.Select(e => e.ErrorMessage); 347Assert.Equal(2, entry.Errors.Count); 348var errorMessages = entry.Errors.Select(e => e.ErrorMessage); 381var error = Assert.Single(entry.Errors); 386error = Assert.Single(entry.Errors); 391error = Assert.Single(entry.Errors); 418var error = Assert.Single(state.Value.Errors); 424var error = Assert.Single(state.Value.Errors); 452var error = Assert.Single(state.Value.Errors); 458var error = Assert.Single(state.Value.Errors); 491var error = Assert.Single(entry.Errors); 496error = Assert.Single(entry.Errors); 501error = Assert.Single(entry.Errors); 506error = Assert.Single(entry.Errors); 540Assert.Empty(entry.Value.Errors); 546var error = Assert.Single(entry.Value.Errors); 555var error = Assert.Single(entry.Value.Errors); 562var error = Assert.Single(entry.Value.Errors); 569var error = Assert.Single(entry.Value.Errors); 637Assert.Empty(entry.Errors); 668Assert.Empty(entry.Errors); 672var error = Assert.Single(entry.Errors); 704Assert.Empty(entry.Errors); 708var error = Assert.Single(entry.Errors); 744var error = Assert.Single(entry.Errors); 774Assert.Empty(entry.Errors); 778Assert.Empty(entry.Errors); 805var error = Assert.Single(entry.Errors); 810error = Assert.Single(entry.Errors); 815error = Assert.Single(entry.Errors); 820error = Assert.Single(entry.Errors); 848var error = Assert.Single(entry.Errors); 853error = Assert.Single(entry.Errors); 858error = Assert.Single(entry.Errors); 863error = Assert.Single(entry.Errors); 930Assert.Empty(entry.Errors); 934Assert.Empty(entry.Errors); 938Assert.Empty(entry.Errors); 964var error = Assert.Single(state.Value.Errors); 970var error = Assert.Single(state.Value.Errors); 1006Assert.Empty(entry.Errors); 1010Assert.Empty(entry.Errors); 1014Assert.Empty(entry.Errors); 1018Assert.Empty(entry.Errors); 1054Assert.Empty(entry.Errors); 1058Assert.Empty(entry.Errors); 1062var error = Assert.Single(entry.Errors); 1067error = Assert.Single(entry.Errors); 1072error = Assert.Single(entry.Errors); 1077error = Assert.Single(entry.Errors); 1153Assert.Empty(entry.Errors); 1183Assert.Empty(entry.Errors); 1216Assert.Empty(entry.Value.Errors); 1249var error = Assert.Single(kvp.Value.Errors); 1256var error = Assert.Single(kvp.Value.Errors);
Microsoft.AspNetCore.Mvc.IntegrationTests (209)
ActionParametersIntegrationTest.cs (9)
71Assert.Empty(modelState[key].Errors); 165Assert.Empty(modelState[key].Errors); 251Assert.Empty(modelState[key].Errors); 342Assert.Empty(modelState[key].Errors); 798var message = entry.Errors.Single().ErrorMessage; 838var message = entry.Errors.Single().ErrorMessage; 843message = entry.Errors.Single().ErrorMessage; 883var message = entry.Errors.Single().ErrorMessage; 888message = entry.Errors.Single().ErrorMessage;
BindPropertyIntegrationTest.cs (1)
295var message = testContext.ModelState[propertyName].Errors.Single().ErrorMessage;
BodyValidationIntegrationTests.cs (6)
391var error = Assert.Single(modelState[key].Errors); 482var error = Assert.Single(entry.Value.Errors); 591var error = Assert.Single(state.Errors); 641var error = Assert.Single(street.Errors); 738var error = Assert.Single(street.Errors); 899foreach (var error in item.Value.Errors)
ByteArrayModelBinderIntegrationTest.cs (2)
63Assert.Empty(entry.Value.Errors); 144Assert.Empty(entry.Value.Errors);
CollectionModelBinderIntegrationTest.cs (4)
331var error = Assert.Single(entry.Errors); 337error = Assert.Single(entry.Errors); 679var error = Assert.Single(entry.Errors); 719var error = Assert.Single(entry.Errors);
ComplexRecordIntegrationTest.cs (23)
1994var error = Assert.Single(modelState["Customer"].Errors); 2050var error = Assert.Single(modelState["Customer"].Errors); 2108var error = Assert.Single(modelState["parameter.Customer.Name"].Errors); 2162var error = Assert.Single(modelState["Customer.Name"].Errors); 2220var error = Assert.Single(modelState["customParameter.Customer.Name"].Errors); 2270var error = Assert.Single(modelState["ProductName"].Errors); 2322var error = Assert.Single(modelState["customParameter.ProductName"].Errors); 2418var error = Assert.Single(modelState["OrderIds"].Errors); 2470var error = Assert.Single(modelState["customParameter.OrderIds"].Errors); 2569var error = Assert.Single(entry.Errors); 2619var error = Assert.Single(entry.Value.Errors); 2678Assert.Empty(entry.Errors); 2726Assert.Empty(entry.Errors); 2786Assert.Empty(entry.Errors); 2839Assert.Empty(entry.Errors); 3015Assert.Empty(state.Value.Errors); 3088Assert.Empty(kvp.Value.Errors); 3096Assert.Empty(kvp.Value.Errors); 3151Assert.Empty(state.Value.Errors); 3213Assert.Empty(kvp.Value.Errors); 3220Assert.Empty(kvp.Value.Errors); 4196Assert.Empty(entry.Value.Errors); 4199var error = Assert.Single(entry.Value.Errors);
ComplexTypeIntegrationTestBase.cs (23)
1896Assert.Single(entry.Errors); 1941Assert.Single(entry.Errors); 2148var error = Assert.Single(modelState["Customer"].Errors); 2203var error = Assert.Single(modelState["Customer"].Errors); 2270var error = Assert.Single(modelState["parameter.Customer.Name"].Errors); 2324var error = Assert.Single(modelState["Customer.Name"].Errors); 2382var error = Assert.Single(modelState["customParameter.Customer.Name"].Errors); 2436var error = Assert.Single(modelState["ProductName"].Errors); 2488var error = Assert.Single(modelState["customParameter.ProductName"].Errors); 2588var error = Assert.Single(modelState["OrderIds"].Errors); 2640var error = Assert.Single(modelState["customParameter.OrderIds"].Errors); 2742var error = Assert.Single(entry.Errors); 2792var error = Assert.Single(entry.Value.Errors); 2857Assert.Empty(entry.Errors); 2905Assert.Empty(entry.Errors); 2977Assert.Empty(entry.Errors); 3030Assert.Empty(entry.Errors); 3223Assert.Empty(state.Value.Errors); 3303Assert.Empty(kvp.Value.Errors); 3311Assert.Empty(kvp.Value.Errors); 3373Assert.Empty(state.Value.Errors); 3435Assert.Empty(kvp.Value.Errors); 3442Assert.Empty(kvp.Value.Errors);
DictionaryModelBinderIntegrationTest.cs (7)
815var error = Assert.Single(entry.Value.Errors); 1333Assert.Equal("The value '' is invalid.", Assert.Single(kvp.Value.Errors).ErrorMessage); 1349Assert.Equal("The Name field is required.", Assert.Single(kvp.Value.Errors).ErrorMessage); 1387Assert.Equal("Invalid is not a valid value for DayOfWeek.", modelState["parameter"].Errors[0].ErrorMessage); 1425Assert.Equal("The value 'BadEnumValue' is not valid for Value.", modelState["parameter[exclamation]"].Errors[0].ErrorMessage); 1486Assert.Equal("The value '' is invalid.", Assert.Single(kvp.Value.Errors).ErrorMessage); 1502Assert.Equal("The Name field is required.", Assert.Single(kvp.Value.Errors).ErrorMessage);
FormCollectionModelBindingIntegrationTest.cs (1)
69Assert.Empty(entry.Value.Errors);
FormFileModelBindingIntegrationTest.cs (12)
70Assert.Empty(modelState[key].Errors); 120Assert.Empty(value.Errors); 171Assert.Empty(value.Errors); 234Assert.Empty(value.Errors); 242Assert.Empty(value.Errors); 324Assert.Empty(value.Errors); 390Assert.Empty(value.Errors); 452Assert.Empty(value.Errors); 460Assert.Empty(value.Errors); 511Assert.Empty(modelStateEntry.Errors); 600Assert.Empty(modelStateEntry.Errors); 649Assert.Empty(entry.Value.Errors);
HeaderModelBinderIntegrationTest.cs (14)
62var error = Assert.Single(modelState[key].Errors); 103Assert.Empty(entry.Value.Errors); 145Assert.Empty(entry.Value.Errors); 192Assert.Empty(modelStateEntry.Errors); 239Assert.Empty(modelStateEntry.Errors); 299Assert.Empty(entry.Value.Errors); 365Assert.Empty(entry.Errors); 374Assert.Empty(entry.Errors); 383Assert.Empty(entry.Errors); 392Assert.Empty(entry.Errors); 401Assert.Empty(entry.Errors); 410Assert.Empty(entry.Errors); 419Assert.Empty(entry.Errors); 428Assert.Empty(entry.Errors);
KeyValuePairModelBinderIntegrationTest.cs (11)
80var error = Assert.Single(entry.Errors); 85Assert.Empty(entry.Errors); 130var error = Assert.Single(entry.Errors); 135Assert.Empty(entry.Errors); 167Assert.Empty(entry.Errors); 172var error = Assert.Single(entry.Errors); 217Assert.Empty(entry.Errors); 222var error = Assert.Single(entry.Errors); 341Assert.Single(entry.Errors); 506Assert.Single(entry.Errors); 509Assert.Single(entry.Errors);
NullableReferenceTypeIntegrationTest.cs (3)
57Assert.Single(kvp.Value.Errors); 143var error = Assert.Single(kvp.Value.Errors); 199Assert.Single(kvp.Value.Errors);
SimpleTypeModelBinderIntegrationTest.cs (14)
62Assert.Empty(modelState[key].Errors); 106Assert.Empty(modelState[key].Errors); 150Assert.Empty(modelState[key].Errors); 227Assert.Empty(modelState[key].Errors); 271Assert.Empty(modelState[key].Errors); 356Assert.Empty(modelState[key].Errors); 404var error = Assert.Single(entry.Errors); 464var error = Assert.Single(entry.Errors); 506var error = Assert.Single(modelState[key].Errors); 560var error = Assert.Single(modelState[key].Errors); 603Assert.Empty(modelState[key].Errors); 699Assert.Empty(entry.Errors); 745Assert.Empty(modelState[key].Errors); 789Assert.Empty(modelState[key].Errors);
TryUpdateModelIntegrationTest.cs (22)
56Assert.Empty(state.Errors); 90Assert.Empty(state.Errors); 200Assert.Empty(state.Errors); 241Assert.Empty(state.Errors); 282Assert.Empty(state.Errors); 343Assert.Empty(state.Errors); 447Assert.Empty(state.Errors); 495Assert.Empty(state.Errors); 663Assert.Empty(state.Errors); 697Assert.Empty(state.Errors); 800Assert.Empty(state.Errors); 836Assert.Empty(state.Errors); 877Assert.Empty(state.Errors); 928Assert.Empty(state.Errors); 964Assert.Empty(state.Errors); 1012Assert.Empty(state.Errors); 1080Assert.Empty(modelStateEntry.Errors); 1133Assert.Empty(state.Errors); 1204Assert.Empty(state.Errors); 1211Assert.Empty(state.Errors); 1259Assert.Empty(state.Errors); 1268Assert.Empty(state.Errors);
TryValidateModelIntegrationTest.cs (1)
230foreach (var error in item.Value.Errors)
ValidationIntegrationTests.cs (28)
117var error = Assert.Single(entry.Errors); 197Assert.Empty(entry.Errors); 236var error = Assert.Single(entry.Errors); 286Assert.Empty(entry.Errors); 325var error = Assert.Single(entry.Errors); 377Assert.Empty(entry.Errors); 419var error = Assert.Single(entry.Errors); 469Assert.Empty(entry.Errors); 509var error = Assert.Single(entry.Errors); 555Assert.Empty(entry.Errors); 597var error = Assert.Single(entry.Errors); 713Assert.Empty(entry.Errors); 751var error = Assert.Single(entry.Errors); 801Assert.Empty(entry.Errors); 839var error = Assert.Single(entry.Errors); 936Assert.Empty(entry.Errors); 978var error = Assert.Single(entry.Errors); 1043Assert.Empty(entry.Errors); 1086var error = Assert.Single(entry.Errors); 1131Assert.Empty(entry.Errors); 1169var error = Assert.Single(entry.Errors); 1248Assert.Single(entry.Errors); 1250var error = entry.Errors[0]; 1288Assert.Single(entry.Errors); 1290var error = entry.Errors[0]; 1380var error = Assert.Single(state.Value.Errors); 1427var error = Assert.Single(state.Errors); 2302Assert.Single(entry.Errors);
ValidationWithRecordIntegrationTests.cs (28)
109var error = Assert.Single(entry.Errors); 185Assert.Empty(entry.Errors); 224var error = Assert.Single(entry.Errors); 267Assert.Empty(entry.Errors); 306var error = Assert.Single(entry.Errors); 349Assert.Empty(entry.Errors); 391var error = Assert.Single(entry.Errors); 434Assert.Empty(entry.Errors); 474var error = Assert.Single(entry.Errors); 514Assert.Empty(entry.Errors); 556var error = Assert.Single(entry.Errors); 596Assert.Empty(entry.Errors); 634var error = Assert.Single(entry.Errors); 677Assert.Empty(entry.Errors); 715var error = Assert.Single(entry.Errors); 805Assert.Empty(entry.Errors); 847var error = Assert.Single(entry.Errors); 905Assert.Empty(entry.Errors); 948var error = Assert.Single(entry.Errors); 989Assert.Empty(entry.Errors); 1027var error = Assert.Single(entry.Errors); 1100Assert.Single(entry.Errors); 1102var error = entry.Errors[0]; 1140Assert.Single(entry.Errors); 1142var error = entry.Errors[0]; 1224var error = Assert.Single(state.Value.Errors); 1271var error = Assert.Single(state.Errors); 2093Assert.Single(entry.Errors);
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (20)
JsonPatchExtensionsTest.cs (4)
26var error = Assert.Single(modelState["Customer"].Errors); 44var error = Assert.Single(modelState["jsonpatch.Customer"].Errors); 88Assert.Single(modelState.First().Value.Errors); 89Assert.Equal(error, modelState.First().Value.Errors.First().ErrorMessage);
NewtonsoftJsonInputFormatterTest.cs (9)
172var message = formatterContext.ModelState.Values.First().Errors[0].ErrorMessage; 250var modelError = formatterContext.ModelState[modelStateKey].Errors.Single(); 276var error = Assert.Single(kvp.Value.Errors); 282var error = Assert.Single(kvp.Value.Errors); 305var modelError = formatterContext.ModelState[string.Empty].Errors.Single(); 338var modelError = formatterContext.ModelState[string.Empty].Errors.Single(); 369var modelError = Assert.Single(formatterContext.ModelState["dateValue"].Errors); 400var modelError = Assert.Single(formatterContext.ModelState["shortValue"].Errors); 431var modelError = Assert.Single(formatterContext.ModelState["Complex.WithPrimitives[0].shortValue"].Errors);
NewtonsoftJsonPatchInputFormatterTest.cs (1)
219Assert.Contains(exceptionMessage, formatterContext.ModelState[""].Errors[0].ErrorMessage);
src\Mvc\Mvc.Core\test\Formatters\JsonInputFormatterTestBase.cs (6)
330Assert.Single(kvp.Value.Errors); 356Assert.Single(kvp.Value.Errors); 409Assert.Single(kvp.Value.Errors); 435var error = Assert.Single(formatterContext.ModelState[""].Errors); 490Assert.Single(kvp.Value.Errors); 534Assert.Single(formatterContext.ModelState["Person.Name"].Errors);
Microsoft.AspNetCore.Mvc.RazorPages.Test (3)
Infrastructure\PageBinderFactoryTest.cs (1)
749var error = Assert.Single(entry.Value.Errors);
PageModelTest.cs (1)
1776var error = Assert.Single(modelState.Value.Errors);
PageTest.cs (1)
1854var error = Assert.Single(modelState.Value.Errors);
Microsoft.AspNetCore.Mvc.ViewFeatures (10)
DefaultHtmlGenerator.cs (7)
584if (entry.Errors.Count > 0) 670if (entry != null && entry.Errors.Count > 0) 741var modelErrors = tryGetModelStateResult ? entry.Errors : null; 819entryForModel.Errors.Count == 0)) 850for (var i = 0; i < modelState.Errors.Count; i++) 852var modelError = modelState.Errors[i]; 1262if (viewContext.ViewData.ModelState.TryGetValue(fullName, out var entry) && entry.Errors.Count > 0)
ModelStateDictionaryExtensions.cs (3)
16/// Adds the specified <paramref name="errorMessage"/> to the <see cref="ModelStateEntry.Errors"/> instance 38/// Adds the specified <paramref name="exception"/> to the <see cref="ModelStateEntry.Errors"/> instance 64/// Adds the specified <paramref name="exception"/> to the <see cref="ModelStateEntry.Errors"/> instance
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (12)
ModelStateDictionaryExtensionsTest.cs (12)
19var modelError = Assert.Single(modelState.Value.Errors); 36var modelError = Assert.Single(modelState.Value.Errors); 53var modelError = Assert.Single(modelState.Value.Errors); 71var modelError = Assert.Single(modelState.Value.Errors); 89var modelError = Assert.Single(modelState.Value.Errors); 109var modelError = Assert.Single(modelState.Value.Errors); 127var modelError = Assert.Single(modelState.Value.Errors); 147var modelError = Assert.Single(modelState.Value.Errors); 165var modelError = Assert.Single(modelState.Value.Errors); 185var modelError = Assert.Single(modelState.Value.Errors); 204var modelError = Assert.Single(modelState.Value.Errors); 225var modelError = Assert.Single(modelState.Value.Errors);
XmlFormattersWebSite (2)
Controllers\HomeController.cs (1)
34var errors = keyModelStatePair.Value.Errors;
Controllers\ValidationController.cs (1)
32var errors = keyModelStatePair.Value.Errors;