172 references to SetModelValue
Microsoft.AspNetCore.Mvc.Abstractions (1)
ModelBinding\ModelStateDictionary.cs (1)
508
SetModelValue
(key, rawValue, valueProviderResult.ToString());
Microsoft.AspNetCore.Mvc.Abstractions.Test (31)
ModelBinding\ModelStateDictionaryTest.cs (31)
98
modelStateDictionary.
SetModelValue
(key, value, value);
147
source.
SetModelValue
("key", "value", "value");
206
source.
SetModelValue
("key", "value", "value");
265
source.
SetModelValue
("key", "attempted-value", "raw-value");
347
oldDictionary.
SetModelValue
("foo", "bar", "bar");
536
dictionary.
SetModelValue
("qux", "value", "value");
553
dictionary1.
SetModelValue
("foo", "RawValue1", "AttemptedValue1");
558
dictionary2.
SetModelValue
("bar", "RawValue2", "AttemptedValue2");
584
dictionary1.
SetModelValue
(key, "RawValue1", "AttemptedValue1");
587
dictionary1.
SetModelValue
("other-key", null, null);
590
dictionary2.
SetModelValue
(key, "RawValue2", "AttemptedValue2");
615
dictionary.
SetModelValue
("foo", "value", "value");
632
dictionary.
SetModelValue
("some key", new string[] { "some value" }, "some value");
652
dictionary.
SetModelValue
("some key", new string[] { "some value" }, "some value");
669
dictionary.
SetModelValue
("user.Name", new string[] { "some value" }, "some value");
684
dictionary.
SetModelValue
("user.Name", new string[] { "some value" }, "some value");
1075
dictionary.
SetModelValue
("key", new string[] { "some value" }, "some value");
1092
dictionary.
SetModelValue
("key", new string[] { "some value" }, "some value");
1110
dictionary.
SetModelValue
("key", new string[] { "some value" }, "some value");
1137
dictionary.
SetModelValue
("key", new string[] { "some value" }, "some value");
1166
dictionary.
SetModelValue
("key", new string[] { "some value" }, "some value");
1192
dictionary.
SetModelValue
("key", new string[] { "some value" }, "some value");
1403
dictionary.
SetModelValue
("Property1.Property2", "value", "value");
1452
modelStateDictionary.
SetModelValue
("prop", "value1", "value1");
1453
modelStateDictionary.
SetModelValue
("property_name", "value3", "value3");
1454
modelStateDictionary.
SetModelValue
("property", "value2", "value2");
1527
dictionary.
SetModelValue
("Property1.Property2", "value", "value");
1572
modelStateDictionary.
SetModelValue
("property1", "value1", "value1");
1573
modelStateDictionary.
SetModelValue
("property1.property2", "value2", "value2");
1593
modelStateDictionary.
SetModelValue
("[property]", "value1", "value1");
1687
var invalidException = Assert.Throws<InvalidOperationException>(() => dictionary.
SetModelValue
(key, string.Empty, string.Empty));
Microsoft.AspNetCore.Mvc.Core (2)
ModelBinding\Binders\FormFileModelBinder.cs (1)
126
bindingContext.ModelState.
SetModelValue
(
ModelBinding\Binders\HeaderModelBinder.cs (1)
154
bindingContext.ModelState.
SetModelValue
(
Microsoft.AspNetCore.Mvc.Core.Test (40)
ModelBinding\ParameterBinderTest.cs (3)
537
modelState.
SetModelValue
("id", "notAGuid", "notAGuid");
596
modelState.
SetModelValue
("id", "notAGuid", "notAGuid");
668
modelState.
SetModelValue
("id", "notAnInt", "notAnInt");
ModelBinding\Validation\DefaultObjectValidatorTests.cs (34)
33
modelState.
SetModelValue
("parameter", "15", "15");
59
modelState.
SetModelValue
("parameter", "test", "test");
88
modelState.
SetModelValue
("parameter", "test", "test");
115
modelState.
SetModelValue
("parameter", "test", "test");
164
modelState.
SetModelValue
("parameter.Reference", "ref", "ref");
165
modelState.
SetModelValue
("parameter.Value", "256", "256");
196
modelState.
SetModelValue
("parameter.Reference", "ref", "ref");
197
modelState.
SetModelValue
("parameter.Value", "256", "256");
264
modelState.
SetModelValue
("person.Name", "Billy", "Billy");
265
modelState.
SetModelValue
("person.Address.Street", "GreaterThan5Characters", "GreaterThan5Characters");
302
modelState.
SetModelValue
("parameter.Street", "Microsoft Way", "Microsoft Way");
334
modelState.
SetModelValue
("Street", "Microsoft Way", "Microsoft Way");
366
modelState.
SetModelValue
("Name", "Rick", "Rick");
478
modelState.
SetModelValue
("parameter", "model", "model");
526
modelState.
SetModelValue
("parameter", "model", "model");
625
modelState.
SetModelValue
("parameter", "5", "5");
656
modelState.
SetModelValue
("parameter.Name", "Billy", "Billy");
692
modelState.
SetModelValue
("parameter.Name", "Billy", "Billy");
730
modelState.
SetModelValue
("user.Password", "password-val", "password-val");
731
modelState.
SetModelValue
("user.ConfirmPassword", "not-password-val", "not-password-val");
761
modelState.
SetModelValue
("parameter[0]", "5", "17");
762
modelState.
SetModelValue
("parameter[1]", "17", "5");
910
modelState.
SetModelValue
("items[0]", "value1", "value1");
911
modelState.
SetModelValue
("items[1]", "value2", "value2");
912
modelState.
SetModelValue
("items[2]", "value3", "value3");
991
modelState.
SetModelValue
("items[0].Key", "key0", "key0");
992
modelState.
SetModelValue
("items[0].Value", "value0", "value0");
993
modelState.
SetModelValue
("items[1].Key", "key1", "key1");
994
modelState.
SetModelValue
("items[1].Value", "value1", "value1");
1034
modelState.
SetModelValue
("[0].Key", "Joe", "Joe");
1035
modelState.
SetModelValue
("[1].Key", "Mark", "Mark");
1141
modelState.
SetModelValue
("user.Password", "password-val", "password-val");
1171
modelState.
SetModelValue
("userIds[0]", "15", "15");
1203
modelState.
SetModelValue
("parameter", rawValue: null, attemptedValue: null);
SerializableErrorTests.cs (2)
71
modelState.
SetModelValue
("key1", "value1", "value1");
72
modelState.
SetModelValue
("key2", "value2", "value2");
ValidationProblemDetailsTest.cs (1)
27
modelStateDictionary.
SetModelValue
("key2", new object(), "value");
Microsoft.AspNetCore.Mvc.IntegrationTests (17)
BinderTypeBasedModelBinderIntegrationTest.cs (3)
331
bindingContext.ModelState.
SetModelValue
(
356
bindingContext.ModelState.
SetModelValue
(
374
bindingContext.ModelState.
SetModelValue
(
ValidationIntegrationTests.cs (7)
1582
modelState.
SetModelValue
(
1622
modelState.
SetModelValue
(
1672
modelState.
SetModelValue
(
1801
modelState.
SetModelValue
("CustomParameter.message", "Hello", "Hello");
1844
modelState.
SetModelValue
("message", "Hello", "Hello");
1889
modelState.
SetModelValue
("other.key", "1", "1");
1936
modelState.
SetModelValue
("other.key", "1", "1");
ValidationWithRecordIntegrationTests.cs (7)
1390
modelState.
SetModelValue
(
1430
modelState.
SetModelValue
(
1478
modelState.
SetModelValue
(
1604
modelState.
SetModelValue
("CustomParameter.message", "Hello", "Hello");
1647
modelState.
SetModelValue
("message", "Hello", "Hello");
1692
modelState.
SetModelValue
("other.key", "1", "1");
1739
modelState.
SetModelValue
("other.key", "1", "1");
Microsoft.AspNetCore.Mvc.TagHelpers.Test (5)
ValidationSummaryTagHelperTest.cs (5)
667
modelState.
SetModelValue
(key: nameof(Model.Empty), rawValue: null, attemptedValue: null);
668
modelState.
SetModelValue
(key: $"{nameof(Model.Strings)}[0]", rawValue: null, attemptedValue: null);
669
modelState.
SetModelValue
(key: $"{nameof(Model.Strings)}[1]", rawValue: null, attemptedValue: null);
670
modelState.
SetModelValue
(key: $"{nameof(Model.Strings)}[2]", rawValue: null, attemptedValue: null);
671
modelState.
SetModelValue
(key: nameof(Model.Text), rawValue: null, attemptedValue: null);
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (76)
DefaultEditorTemplatesTest.cs (1)
535
viewData.ModelState.
SetModelValue
("FieldPrefix", "Raw model string", "Attempted model string");
DefaultHtmlGeneratorTest.cs (9)
590
viewContext.ModelState.
SetModelValue
(nameof(Model.Name), rawValue, attemptedValue: null);
618
viewContext.ModelState.
SetModelValue
(nameof(Model.Name), rawValue, attemptedValue: null);
666
viewContext.ModelState.
SetModelValue
(nameof(Model.Name), rawValue, attemptedValue: null);
694
viewContext.ModelState.
SetModelValue
(nameof(Model.Name), rawValue, attemptedValue: null);
717
viewContext.ModelState.
SetModelValue
(nameof(Model.Name), rawValue, attemptedValue: null);
772
viewContext.ModelState.
SetModelValue
(nameof(Model.Collection), rawValue, attemptedValue: null);
801
viewContext.ModelState.
SetModelValue
(nameof(Model.Collection), rawValue, attemptedValue: null);
827
viewContext.ModelState.
SetModelValue
(
939
viewContext.ModelState.
SetModelValue
(
ModelStateDictionaryExtensionsTest.cs (21)
236
dictionary.
SetModelValue
("Text", "value", "value");
250
dictionary.
SetModelValue
("Child.Text", "value", "value");
264
dictionary.
SetModelValue
("Child.Value", "value", "value");
279
dictionary.
SetModelValue
("variable", "value", "value");
294
dictionary.
SetModelValue
("Key", "value1", "value1");
295
dictionary.
SetModelValue
("Text", "value2", "value2");
296
dictionary.
SetModelValue
("Text.Length", "value3", "value3");
314
dictionary.
SetModelValue
("Key", "value1", "value1");
315
dictionary.
SetModelValue
("Child", "value2", "value2");
316
dictionary.
SetModelValue
("Child.Text", "value3", "value3");
334
dictionary.
SetModelValue
("Child", "value1", "value1");
335
dictionary.
SetModelValue
("Child.Value", "value2", "value2");
354
dictionary.
SetModelValue
("Key", "value1", "value1");
355
dictionary.
SetModelValue
("variable", "value2", "value2");
356
dictionary.
SetModelValue
("variable.Text", "value3", "value3");
357
dictionary.
SetModelValue
("variable.Value", "value4", "value4");
376
dictionary.
SetModelValue
("Key", "value1", "value1");
377
dictionary.
SetModelValue
("Text", "value2", "value2");
378
dictionary.
SetModelValue
("Child", "value3", "value3");
379
dictionary.
SetModelValue
("Child.Text", "value4", "value4");
380
dictionary.
SetModelValue
("Child.NoValue", "value5", "value5");
Rendering\HtmlHelperCheckboxTest.cs (3)
266
helper.ViewData.ModelState.
SetModelValue
("Property1", new string[] { "false" }, "false");
571
viewData.ModelState.
SetModelValue
("Property1", new string[] { "false" }, "false");
666
viewData.ModelState.
SetModelValue
("Property1", new string[] { attemptedValue }, attemptedValue);
Rendering\HtmlHelperDisplayTextTest.cs (2)
262
viewData.ModelState.
SetModelValue
(
287
viewData.ModelState.
SetModelValue
(
Rendering\HtmlHelperDropDownListExtensionsTest.cs (3)
33
helper.ViewData.ModelState.
SetModelValue
("Property1", 3, "3");
57
helper.ViewData.ModelState.
SetModelValue
("Property1", 1, "1");
108
helper.ViewData.ModelState.
SetModelValue
("Property1", 4, "4");
Rendering\HtmlHelperHiddenTest.cs (10)
377
helper.ViewData.ModelState.
SetModelValue
(
381
helper.ViewData.ModelState.
SetModelValue
(
385
helper.ViewData.ModelState.
SetModelValue
(
704
helper.ViewData.ModelState.
SetModelValue
(
708
helper.ViewData.ModelState.
SetModelValue
(
712
helper.ViewData.ModelState.
SetModelValue
(
855
viewData.ModelState.
SetModelValue
("pre.Property3[key]", "Prop3Val", "Prop3Val");
856
viewData.ModelState.
SetModelValue
("pre.Property4.Property5", "Prop5Val", "Prop5Val");
857
viewData.ModelState.
SetModelValue
("pre.Property4.Property6[0]", "Prop6Val", "Prop6Val");
964
viewData.ModelState.
SetModelValue
("Property1", "ModelStateValue", "ModelStateValue");
Rendering\HtmlHelperListBoxExtensionsTest.cs (1)
33
helper.ViewData.ModelState.
SetModelValue
("Property1", 2, "2");
Rendering\HtmlHelperPasswordTest.cs (7)
356
viewData.ModelState.
SetModelValue
("pre.Property3[key]", "Property3Val", "Property3Val");
357
viewData.ModelState.
SetModelValue
("pre.Property4.Property5", "Property5Val", "Property5Val");
358
viewData.ModelState.
SetModelValue
("pre.Property4.Property6[0]", "Property6Val", "Property6Val");
458
viewData.ModelState.
SetModelValue
("Property1", "ModelStateValue", "ModelStateValue");
507
helper.ViewData.ModelState.
SetModelValue
("pre.Property3[key]", "MProp3Val", "MProp3Val");
508
helper.ViewData.ModelState.
SetModelValue
("pre.Property4.Property5", "MProp5Val", "MProp5Val");
509
helper.ViewData.ModelState.
SetModelValue
("pre.Property4.Property6[0]", "MProp6Val", "MProp6Val");
Rendering\HtmlHelperSelectTest.cs (8)
412
modelState.
SetModelValue
(
416
modelState.
SetModelValue
(
449
modelState.
SetModelValue
(
453
modelState.
SetModelValue
(
815
modelState.
SetModelValue
(
819
modelState.
SetModelValue
(
852
modelState.
SetModelValue
(
856
modelState.
SetModelValue
(
Rendering\HtmlHelperTextAreaTest.cs (3)
124
helper.ViewData.ModelState.
SetModelValue
("pre.Property3[key]", "MProp3Val", "MProp3Val");
125
helper.ViewData.ModelState.
SetModelValue
("pre.Property4.Property5", "MProp5Val", "MProp5Val");
126
helper.ViewData.ModelState.
SetModelValue
("pre.Property4.Property6[0]", "MProp6Val", "MProp6Val");
Rendering\HtmlHelperTextBoxTest.cs (3)
142
helper.ViewData.ModelState.
SetModelValue
("pre.Property3[key]", "MProp3Val", "MProp3Val");
143
helper.ViewData.ModelState.
SetModelValue
("pre.Property4.Property5", "MProp5Val", "MProp5Val");
144
helper.ViewData.ModelState.
SetModelValue
("pre.Property4.Property6[0]", "MProp6Val", "MProp6Val");
Rendering\HtmlHelperValidationSummaryTest.cs (2)
667
modelState.
SetModelValue
("Property3.Empty", rawValue: null, attemptedValue: null);
710
modelState.
SetModelValue
("Empty", rawValue: null, attemptedValue: null);
Rendering\HtmlHelperValueTest.cs (3)
163
viewData.ModelState.
SetModelValue
(
168
viewData.ModelState.
SetModelValue
(
220
viewData.ModelState.
SetModelValue
(