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