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