From fb4aff44bc74803d0ff73c675292b055c7b9bbef Mon Sep 17 00:00:00 2001 From: cime Date: Mon, 1 Mar 2021 21:51:03 +0100 Subject: [PATCH] cleanup: validation - removed Success --- CoreSharp.Validation.Tests/Models/AsyncParent.cs | 4 ++-- CoreSharp.Validation.Tests/Models/TestModel.cs | 5 +++-- CoreSharp.Validation/AbstractAsyncDomainValidator.cs | 2 -- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CoreSharp.Validation.Tests/Models/AsyncParent.cs b/CoreSharp.Validation.Tests/Models/AsyncParent.cs index c41e73e..91ffb30 100644 --- a/CoreSharp.Validation.Tests/Models/AsyncParent.cs +++ b/CoreSharp.Validation.Tests/Models/AsyncParent.cs @@ -84,11 +84,11 @@ public override Task BeforeValidationAsync(TModel root, ValidationContext contex return Task.CompletedTask; } - public override async IAsyncEnumerable ValidateAsync(TChild child, ValidationContext context) + public override IAsyncEnumerable ValidateAsync(TChild child, ValidationContext context) { ValidateModels.Add(new Tuple(child, this)); - yield break; + return null; } public override Task CanValidateAsync(TChild child, ValidationContext context) diff --git a/CoreSharp.Validation.Tests/Models/TestModel.cs b/CoreSharp.Validation.Tests/Models/TestModel.cs index 1ea534e..ebbff62 100644 --- a/CoreSharp.Validation.Tests/Models/TestModel.cs +++ b/CoreSharp.Validation.Tests/Models/TestModel.cs @@ -57,10 +57,11 @@ public override Task BeforeValidationAsync(TestModel root, ValidationContext con return Task.CompletedTask; } - public override async IAsyncEnumerable ValidateAsync(TestModel child, ValidationContext context) + public override IAsyncEnumerable ValidateAsync(TestModel child, ValidationContext context) { ValidateCount++; - yield break; + + return null; } public override Task CanValidateAsync(TestModel child, ValidationContext context) diff --git a/CoreSharp.Validation/AbstractAsyncDomainValidator.cs b/CoreSharp.Validation/AbstractAsyncDomainValidator.cs index ce6e1c1..42dfec8 100644 --- a/CoreSharp.Validation/AbstractAsyncDomainValidator.cs +++ b/CoreSharp.Validation/AbstractAsyncDomainValidator.cs @@ -52,7 +52,5 @@ protected ValidationFailure Failure(string errorMessage, ValidationContext conte { return DomainValidationContext.CreateValidationFailure(errorMessage, context); } - - protected ValidationFailure Success => null; } }