63 references to TryValidateObject
Microsoft.AspNetCore.Components.Forms (1)
EditContextDataAnnotationsExtensions.cs (1)
114Validator.TryValidateObject(_editContext.Model, validationContext, validationResults, true);
Microsoft.Extensions.Options.DataAnnotations (1)
DataAnnotationValidateOptions.cs (1)
85bool res = Validator.TryValidateObject(options, new ValidationContext(options), results, validateAllProperties: true);
Shared.Tests (60)
Data.Validation\LengthAttributeTests.cs (34)
34Assert.True(Validator.TryValidateObject(options, context, results, true)); 39Assert.False(Validator.TryValidateObject(options, context, results, true)); 46Assert.True(Validator.TryValidateObject(options, context, results, true)); 53Assert.False(Validator.TryValidateObject(options, context, results, true)); 60Assert.False(Validator.TryValidateObject(options, context, results, true)); 67Assert.True(Validator.TryValidateObject(options, context, results, true)); 90Assert.True(Validator.TryValidateObject(options, context, results, true)); 95Assert.False(Validator.TryValidateObject(options, context, results, true)); 102Assert.True(Validator.TryValidateObject(options, context, results, true)); 109Assert.False(Validator.TryValidateObject(options, context, results, true)); 117Assert.False(Validator.TryValidateObject(options, context, results, true)); 124Assert.True(Validator.TryValidateObject(options, context, results, true)); 161Assert.True(Validator.TryValidateObject(options, context, results, true)); 168Assert.False(Validator.TryValidateObject(options, context, results, true)); 178Assert.True(Validator.TryValidateObject(options, context, results, true)); 186Assert.False(Validator.TryValidateObject(options, context, results, true)); 196Assert.True(Validator.TryValidateObject(options, context, results, true)); 218Assert.True(Validator.TryValidateObject(options, context, results, true)); 222Assert.False(Validator.TryValidateObject(options, context, results, true)); 229Assert.True(Validator.TryValidateObject(options, context, results, true)); 234Assert.False(Validator.TryValidateObject(options, context, results, true)); 241Assert.True(Validator.TryValidateObject(options, context, results, true)); 268Assert.True(Validator.TryValidateObject(options, context, results, true)); 275Assert.False(Validator.TryValidateObject(options, context, results, true)); 285Assert.True(Validator.TryValidateObject(options, context, results, true)); 293Assert.False(Validator.TryValidateObject(options, context, results, true)); 303Assert.True(Validator.TryValidateObject(options, context, results, true)); 343Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options0, context, results, true)); 348Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options1, context, results, true)); 353Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options2, context, results, true)); 358Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options3, context, results, true)); 363Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options4, context, results, true)); 393Assert.False(Validator.TryValidateObject(options, context, results, true)); 413Assert.False(Validator.TryValidateObject(options, context, results, true));
Data.Validation\TimeSpanAttributeTests.cs (26)
32Assert.True(Validator.TryValidateObject(options, context, results, true)); 37Assert.False(Validator.TryValidateObject(options, context, results, true)); 44Assert.False(Validator.TryValidateObject(options, context, results, true)); 51Assert.True(Validator.TryValidateObject(options, context, results, true)); 56Assert.True(Validator.TryValidateObject(options, context, results, true)); 62Assert.False(Validator.TryValidateObject(options, context, results, true)); 69Assert.True(Validator.TryValidateObject(options, context, results, true)); 74Assert.True(Validator.TryValidateObject(options, context, results, true)); 97Assert.True(Validator.TryValidateObject(options, context, results, true)); 102Assert.False(Validator.TryValidateObject(options, context, results, true)); 109Assert.False(Validator.TryValidateObject(options, context, results, true)); 116Assert.True(Validator.TryValidateObject(options, context, results, true)); 123Assert.False(Validator.TryValidateObject(options, context, results, true)); 130Assert.False(Validator.TryValidateObject(options, context, results, true)); 137Assert.True(Validator.TryValidateObject(options, context, results, true)); 160Assert.True(Validator.TryValidateObject(options, context, results, true)); 165Assert.False(Validator.TryValidateObject(options, context, results, true)); 172Assert.False(Validator.TryValidateObject(options, context, results, true)); 179Assert.True(Validator.TryValidateObject(options, context, results, true)); 184Assert.True(Validator.TryValidateObject(options, context, results, true)); 190Assert.False(Validator.TryValidateObject(options, context, results, true)); 197Assert.True(Validator.TryValidateObject(options, context, results, true)); 202Assert.True(Validator.TryValidateObject(options, context, results, true)); 230Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options0, context, results, true)); 235Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options1, context, results, true)); 240Assert.Throws<InvalidOperationException>(() => _ = Validator.TryValidateObject(options3, context, results, true));
System.ComponentModel.Annotations (1)
System\ComponentModel\DataAnnotations\Validator.cs (1)
97TryValidateObject(instance, validationContext, validationResults, validateAllProperties: false);