-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into bugfix/204-inconsistent-field-level-validation
- Loading branch information
Showing
35 changed files
with
1,148 additions
and
31 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
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
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FluentValidation" Version="11.1.0" /> | ||
<PackageReference Include="FluentValidation" Version="11.9.2" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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
33 changes: 33 additions & 0 deletions
33
tests/Blazored.FluentValidation.Tests/AssemblyScanning/Component.razor
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,33 @@ | ||
<EditForm | ||
Model="@_person" | ||
OnValidSubmit="ValidSubmit" | ||
OnInvalidSubmit="InvalidSubmit"> | ||
|
||
@if (DisableAssemblyScanning is null) | ||
{ | ||
<FluentValidationValidator /> | ||
} | ||
else | ||
{ | ||
<FluentValidationValidator DisableAssemblyScanning="DisableAssemblyScanning.Value" /> | ||
} | ||
|
||
<ValidationSummary/> | ||
|
||
<p> | ||
<label>First name: </label> | ||
<InputText name="@nameof(_person.FirstName)" @bind-Value="@_person.FirstName"/> | ||
</p> | ||
|
||
<button type="submit">Save</button> | ||
</EditForm> | ||
|
||
@code { | ||
[Parameter] public bool? DisableAssemblyScanning { get; set; } | ||
private readonly Person _person = new(); | ||
|
||
internal ValidationResultType Result { get; private set; } = ValidationResultType.Valid; | ||
|
||
private void ValidSubmit() => Result = ValidationResultType.Valid; | ||
private void InvalidSubmit() => Result = ValidationResultType.Error; | ||
} |
9 changes: 9 additions & 0 deletions
9
tests/Blazored.FluentValidation.Tests/AssemblyScanning/Readme.md
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,9 @@ | ||
### What does this test? | ||
This test checks if the assembly scanning works. It leverages, that this test | ||
assembly does not register any `AbstractValidator` by default. | ||
|
||
- Setting the `DisableAssemblyScanning` to `true` should not find any validators and ignore errors. | ||
- Setting the `DisableAssemblyScanning` to `false` or not setting the attribute at all, should | ||
find the validators in the assembly and validate normally. | ||
- Setting the `DisableAssemblyScanning` to `true` and registering the validators manually should | ||
find the validators and validate normally. |
Oops, something went wrong.