Skip to content

Commit 7d5b7b1

Browse files
committed
Merge branch 'master' into production for v3.0.0-beta.1
2 parents 557f44d + 6ebde9c commit 7d5b7b1

910 files changed

Lines changed: 133129 additions & 9484 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.appveyor.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,54 @@
11
version: '{branch}-{build}'
2-
image: Visual Studio 2017
2+
3+
environment:
4+
matrix:
5+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
6+
JAVA_HOME: C:\Program Files\Java\jdk17
7+
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu
8+
JAVA_HOME: /usr/lib/jvm/jdk15
9+
10+
# A note/reminder for readers: Script items prefixed "cmd:" are executed on Windows-only environments.
11+
# Items with no prefix are run on all environments (Windows & Linux)
312

413
init:
514
- cmd: git config --global core.autocrlf true
615

716
install:
8-
- cmd: git submodule update --init --recursive
917
- cmd: dotnet tool install --global dotnet-sonarscanner
1018

1119
before_build:
12-
- cmd: dotnet --version
13-
- cmd: dotnet restore --verbosity m
14-
- cmd: dotnet-sonarscanner begin /k:"CSF.Validation" /v:AppVeyor_build_%APPVEYOR_BUILD_NUMBER% /o:craigfowler-github /d:sonar.host.url="https://sonarcloud.io" /d:sonar.login=%SONARCLOUD_SECRET_KEY% /d:sonar.cs.nunit.reportsPaths=%APPVEYOR_BUILD_FOLDER%\CSF.Validation.Tests\TestResults\TestResults.xml /d:sonar.cs.opencover.reportsPaths=%APPVEYOR_BUILD_FOLDER%\CSF.Validation.Tests\TestResults\coverage.opencover.xml
20+
- dotnet --version
21+
- dotnet restore --verbosity m
22+
- cmd: >
23+
IF NOT DEFINED APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH (SET BranchName=%APPVEYOR_REPO_BRANCH%)
24+
ELSE (SET BranchName=%APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH%)
25+
- cmd: >
26+
dotnet-sonarscanner begin
27+
/k:"CSF.Validation"
28+
/v:AppVeyor_build_%APPVEYOR_BUILD_NUMBER%
29+
/o:craigfowler-github
30+
/d:sonar.host.url="https://sonarcloud.io"
31+
/d:sonar.login=%SONARCLOUD_SECRET_KEY%
32+
/d:sonar.cs.nunit.reportsPaths=%APPVEYOR_BUILD_FOLDER%\CSF.Validation.Tests\TestResults\TestResults.xml
33+
/d:sonar.cs.opencover.reportsPaths=%APPVEYOR_BUILD_FOLDER%\CSF.Validation.Tests\TestResults\coverage.opencover.xml
34+
/d:sonar.branch.name=%BranchName%
35+
/s:%APPVEYOR_BUILD_FOLDER%\.sonarqube-analysisproperties.xml
1536
1637
build_script:
17-
- cmd: dotnet build
38+
- dotnet build
1839

1940
test_script:
20-
- cmd: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=\"json,opencover\" /p:CoverletOutput=\"TestResults/\" --test-adapter-path:. --logger:\"nunit\"
41+
- >
42+
dotnet test
43+
/p:CollectCoverage=true
44+
/p:CoverletOutputFormat=\"json,opencover\"
45+
/p:CoverletOutput=\"TestResults/\"
46+
--test-adapter-path:.
47+
--logger:\"nunit\"
2148
2249
after_test:
23-
- cmd: dotnet-sonarscanner end /d:"sonar.login=%SONARCLOUD_SECRET_KEY%"
50+
- cmd: >
51+
dotnet-sonarscanner end
52+
/d:"sonar.login=%SONARCLOUD_SECRET_KEY%"
53+
- ps: if ($isWindows) { Tools\appveyor-publish-docs.ps1 }
54+
- cmd: Tools\appveyor-create-packages.cmd

.sonarqube-analysisproperties.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<SonarQubeAnalysisProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4+
xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">
5+
<Property Name="sonar.coverage.exclusions">CSF.Validation.Tests.SamplePlugin/**/*,CSF.Validation.Tests/**/*,**/*Exception.cs</Property>
6+
</SonarQubeAnalysisProperties>

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
// Use IntelliSense to find out which attributes exist for C# debugging
6+
// Use hover for the description of the existing attributes
7+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceFolder}/CSF.Validation.Tests/bin/Debug/netcoreapp2.2/CSF.Validation.Tests.dll",
14+
"args": [],
15+
"cwd": "${workspaceFolder}/CSF.Validation.Tests",
16+
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17+
"console": "internalConsole",
18+
"stopAtEntry": false
19+
},
20+
{
21+
"name": ".NET Core Attach",
22+
"type": "coreclr",
23+
"request": "attach"
24+
}
25+
]
26+
}

.vscode/tasks.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"/property:GenerateFullPaths=true",
11+
"/consoleloggerparameters:NoSummary"
12+
],
13+
"problemMatcher": "$msCompile",
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
}
18+
},
19+
{
20+
"label": "test",
21+
"command": "dotnet",
22+
"type": "process",
23+
"args": [
24+
"test",
25+
"/property:GenerateFullPaths=true",
26+
"/consoleloggerparameters:NoSummary"
27+
],
28+
"problemMatcher": "$msCompile",
29+
"group": {
30+
"kind": "test",
31+
"isDefault": true
32+
}
33+
},
34+
{
35+
"label": "Serve documentation website",
36+
"command": "docfx",
37+
"type": "process",
38+
"args": [
39+
"serve",
40+
"CSF.Validation.Documentation/_site"
41+
],
42+
"problemMatcher": [],
43+
"presentation": {
44+
"reveal": "never",
45+
"panel": "shared"
46+
}
47+
}
48+
]
49+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
3+
namespace CSF.Validation.Bootstrap
4+
{
5+
/// <summary>
6+
/// An object which may be used to resolve types that might be available in a <c>IServiceProvider</c>
7+
/// or which might need to be constructed using <see cref="Activator.CreateInstance(Type)"/>.
8+
/// </summary>
9+
/// <remarks>
10+
/// <para>
11+
/// Generally-speaking, this should not be used for validation framework services. Instead, use plain
12+
/// dependency injection or an <c>IServiceProvider</c>.
13+
/// The purpose of this service is for resolution of third-party types/services which might not have been
14+
/// correctly set-up within dependency injection.
15+
/// This service provides other mechanisms by which attempts may be made to resolve the implementation,
16+
/// which would fail if we used just a service provider alone.
17+
/// </para>
18+
/// </remarks>
19+
public interface IResolvesServices
20+
{
21+
/// <summary>
22+
/// Attempts to resolve an instance of the specified implementation type.
23+
/// </summary>
24+
/// <remarks>
25+
/// <para>
26+
/// Attempts to resolve an instance of the specified <paramref name="implementationType"/>, or raises an
27+
/// exception if this is not possible.
28+
/// This might occur for user/developer-provided services, particularly if they are not correctly
29+
/// registered via dependency injection.
30+
/// This method will make attempts to resolve the service regardless, and might succeed where a plain
31+
/// <c>IServiceProvider</c> would fail.
32+
/// </para>
33+
/// </remarks>
34+
/// <typeparam name="T">The expected type of the service.</typeparam>
35+
/// <param name="implementationType">The type of the concrete implementation for the service.</param>
36+
/// <returns>An instance of the requested service; this method will not return <see langword="null" />, it will raise an exception instead.</returns>
37+
/// <exception cref="ResolutionException">If a service instance could not be resolved successfully.</exception>
38+
/// <exception cref="ArgumentNullException">If <paramref name="implementationType"/> is <see langword="null" />.</exception>
39+
/// <exception cref="ArgumentException">If the <paramref name="implementationType"/> does not derive from <typeparamref name="T"/>.</exception>
40+
T ResolveService<T>(Type implementationType);
41+
}
42+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
namespace CSF.Validation.Bootstrap
2+
{
3+
/// <summary>
4+
/// An exception raised by <see cref="IResolvesServices"/> if it is unable to resolve a service instance.
5+
/// </summary>
6+
[System.Serializable]
7+
public class ResolutionException : System.Exception
8+
{
9+
/// <summary>
10+
/// Initialises an instance of <see cref="ResolutionException"/>.
11+
/// </summary>
12+
public ResolutionException() {}
13+
14+
/// <summary>
15+
/// Initialises an instance of <see cref="ResolutionException"/>.
16+
/// </summary>
17+
/// <param name="message">The message.</param>
18+
public ResolutionException(string message) : base(message) {}
19+
20+
/// <summary>
21+
/// Initialises an instance of <see cref="ResolutionException"/>.
22+
/// </summary>
23+
/// <param name="message">The message.</param>
24+
/// <param name="inner">The inner exception.</param>
25+
public ResolutionException(string message, System.Exception inner) : base(message, inner) {}
26+
27+
/// <summary>
28+
/// Initialises an instance of <see cref="ResolutionException"/>.
29+
/// </summary>
30+
/// <param name="info">Serialization info.</param>
31+
/// <param name="context">Streaming context.</param>
32+
protected ResolutionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) {}
33+
}
34+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
5+
<RootNamespace>CSF.Validation</RootNamespace>
6+
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\CSF.Validation.Abstractions.xml</DocumentationFile>
7+
<ReleaseVersion>3.0.0</ReleaseVersion>
8+
<PackageId>CSF.Validation.Abstractions</PackageId>
9+
<Authors>craigfowler</Authors>
10+
<Title>CSF.Validation.Abstractions</Title>
11+
<Description>A framework for business rule validation - abstractions package</Description>
12+
<VersionPrefix>$(ReleaseVersion)</VersionPrefix>
13+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
14+
<PackageReadmeFile>README.md</PackageReadmeFile>
15+
<Copyright>Copyright 2021 - CSF Software Limited</Copyright>
16+
<PackageProjectUrl>https://github.com/csf-dev/CSF.Validation/</PackageProjectUrl>
17+
<RepositoryUrl>$(PackageProjectUrl)</RepositoryUrl>
18+
<SignAssembly>true</SignAssembly>
19+
<AssemblyOriginatorKeyFile>..\CSF-Software-OSS.snk</AssemblyOriginatorKeyFile>
20+
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
21+
</PropertyGroup>
22+
23+
<ItemGroup>
24+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="all" Condition="'$(TargetFramework)' == 'net461'" />
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<None Include="README.md" Pack="true" PackagePath="\"/>
29+
</ItemGroup>
30+
</Project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using CSF.Validation.ValidatorBuilding;
3+
4+
namespace CSF.Validation
5+
{
6+
/// <summary>
7+
/// An object which may be used to build a validator, specifying its configuration such as
8+
/// the rules which the validator will use.
9+
/// </summary>
10+
/// <typeparam name="TValidated">The object type which the created validator will be used to validate.</typeparam>
11+
public interface IBuildsValidator<TValidated>
12+
{
13+
/// <summary>
14+
/// Configures the validator using a helper object.
15+
/// </summary>
16+
/// <param name="config">A helper object which is used to configure the validator.</param>
17+
void ConfigureValidator(IConfiguresValidator<TValidated> config);
18+
}
19+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
namespace CSF.Validation
2+
{
3+
/// <summary>
4+
/// An object which can get the resolved/final/effective validation options, combining all of the ways
5+
/// in which they might be specified.
6+
/// </summary>
7+
/// <remarks>
8+
/// <para>
9+
/// As you will notice, the <see cref="ResolvedValidationOptions"/> class has the same 'shape' as
10+
/// <see cref="ValidationOptions"/>, except that every property is non-nullable.
11+
/// The resolved options are created by taking the first non-null value from each of:
12+
/// </para>
13+
/// <list type="number">
14+
/// <item><description>The specified options</description></item>
15+
/// <item><description>The default options configured at DI registration</description></item>
16+
/// <item><description>Hard-coded default options (if nothing else is specified)</description></item>
17+
/// </list>
18+
/// </remarks>
19+
public interface IGetsResolvedValidationOptions
20+
{
21+
/// <summary>
22+
/// Gets the resolved validation options.
23+
/// </summary>
24+
/// <param name="specifiedOptions">Options which have been specified by a developer via the API; may be <see langword="null" />.</param>
25+
/// <returns>The resolved (or effective) validation options.</returns>
26+
ResolvedValidationOptions GetResolvedValidationOptions(ValidationOptions specifiedOptions);
27+
}
28+
}

0 commit comments

Comments
 (0)