-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
999bec9
commit 615c52a
Showing
6 changed files
with
280 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...ratorTests/ValidatorArgumentTests.FieldAttributeArgument#IV...ValidateClass.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
//HintName: IV...ValidateClass.g.cs | ||
using System.Collections.Generic; | ||
using Immediate.Validations.Shared; | ||
|
||
#nullable enable | ||
#pragma warning disable CS1591 | ||
|
||
|
||
partial class ValidateClass | ||
{ | ||
static List<ValidationError> IValidationTarget<ValidateClass>.Validate(ValidateClass? target) => | ||
Validate(target); | ||
|
||
public static List<ValidationError> Validate(ValidateClass? target) | ||
{ | ||
if (target is not { } t) | ||
{ | ||
return | ||
[ | ||
new() | ||
{ | ||
PropertyName = ".self", | ||
ErrorMessage = "`target` must not be `null`.", | ||
}, | ||
]; | ||
} | ||
|
||
var errors = new List<ValidationError>(); | ||
|
||
|
||
__ValidateStringProperty(errors, t, t.StringProperty); | ||
|
||
|
||
return errors; | ||
} | ||
|
||
|
||
|
||
private static void __ValidateStringProperty( | ||
List<ValidationError> errors, ValidateClass instance, string target | ||
) | ||
{ | ||
|
||
if (target is not { } t) | ||
{ | ||
errors.Add(new() | ||
{ | ||
PropertyName = $"StringProperty", | ||
ErrorMessage = "Property must not be `null`.", | ||
}); | ||
|
||
return; | ||
} | ||
|
||
|
||
|
||
errors.Add( | ||
global::Immediate.Validations.Shared.NotEqualAttribute.ValidateProperty( | ||
t | ||
, operand: instance._argumentValue | ||
), | ||
$"StringProperty", | ||
null | ||
); | ||
} | ||
|
||
} | ||
|
68 changes: 68 additions & 0 deletions
68
...ests/ValidatorArgumentTests.StaticFieldAttributeArgument#IV...ValidateClass.g.verified.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
//HintName: IV...ValidateClass.g.cs | ||
using System.Collections.Generic; | ||
using Immediate.Validations.Shared; | ||
|
||
#nullable enable | ||
#pragma warning disable CS1591 | ||
|
||
|
||
partial class ValidateClass | ||
{ | ||
static List<ValidationError> IValidationTarget<ValidateClass>.Validate(ValidateClass? target) => | ||
Validate(target); | ||
|
||
public static List<ValidationError> Validate(ValidateClass? target) | ||
{ | ||
if (target is not { } t) | ||
{ | ||
return | ||
[ | ||
new() | ||
{ | ||
PropertyName = ".self", | ||
ErrorMessage = "`target` must not be `null`.", | ||
}, | ||
]; | ||
} | ||
|
||
var errors = new List<ValidationError>(); | ||
|
||
|
||
__ValidateStringProperty(errors, t, t.StringProperty); | ||
|
||
|
||
return errors; | ||
} | ||
|
||
|
||
|
||
private static void __ValidateStringProperty( | ||
List<ValidationError> errors, ValidateClass instance, string target | ||
) | ||
{ | ||
|
||
if (target is not { } t) | ||
{ | ||
errors.Add(new() | ||
{ | ||
PropertyName = $"StringProperty", | ||
ErrorMessage = "Property must not be `null`.", | ||
}); | ||
|
||
return; | ||
} | ||
|
||
|
||
|
||
errors.Add( | ||
global::Immediate.Validations.Shared.NotEqualAttribute.ValidateProperty( | ||
t | ||
, operand: _argumentValue | ||
), | ||
$"StringProperty", | ||
null | ||
); | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.