Qowaiv.Validation.TestTools 5.0.0

Prefix Reserved
dotnet add package Qowaiv.Validation.TestTools --version 5.0.0
                    
NuGet\Install-Package Qowaiv.Validation.TestTools -Version 5.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Qowaiv.Validation.TestTools" Version="5.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Qowaiv.Validation.TestTools" Version="5.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Qowaiv.Validation.TestTools" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Qowaiv.Validation.TestTools --version 5.0.0
                    
#r "nuget: Qowaiv.Validation.TestTools, 5.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Qowaiv.Validation.TestTools@5.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Qowaiv.Validation.TestTools&version=5.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Qowaiv.Validation.TestTools&version=5.0.0
                    
Install as a Cake Tool

Qowaiv.Validation Test Tools

These test tools help to write meaningful tests and assert the state of a Result or Result<T>. The syntax is inspired by FluentAssertions.

These assertions could look like this:

Result.For(17).Should().BeValid()
    .WithoutMessages()
    .Value.Should().Be(17); 

Where the chain after .Value exposes the value.

Other options for .BeValid() are:

Result.For(17).Should().BeValid()
    .WithMessage(ValidationMessage.Warn("Are you sure?"))
    .Value.Should().Be(17);

and

Result.For(17).Should().BeValid()
    .WithMessages(/* ... */)
    .Value.Should().Be(17);

Obviously, you can also check for invalidity:

Result.For(17).Should().BeInvalid(); 

In that case you do not have the option of .WithoutMessages(), obviously, as Result is defined to be invalid based on containing at least one error message. Furthermore, it does not expose the .Value as that is not accessible for an invalid result.

Everything except .Value also applies to the non-generic Result.

Validate with

There is also some syntactic sugar for validating a model of choice:

var model = new MyModel();

Result<MyModel> result = model.ValidateWith(new ValidatorForMyModel());

And this result can be changed with the assertions described on top:

var model = new MyModel();
model.ValidateWith(new ValidatorForMyModel()).Should().BeValid();
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0 0 11/26/2026
5.0.0-rc.1 73 11/20/2026
4.1.0 2,593 9/30/2026
4.0.0 10,893 5/21/2026
3.0.0 8,627 1/19/2026
2.0.0 9,687 2/25/2025
1.0.0 2,606 11/19/2024
0.3.0 36,093 3/7/2023
0.2.1 10,679 4/13/2022
0.1.1 12,934 9/10/2021
0.1.0 719 8/31/2021
0.0.3 1,693 6/4/2021
0.0.2 2,288 2/2/2021
0.0.1 3,318 11/1/2019

v5.0.0
- Add .NET 11.0 target.
- Drop .NET 8.0 targets (BREAKING)
- BeValid().And.Value and-constraint syntax.
- Allow Sync Should() an async Results
v4.2.0
- Update to Qowaiv v8.2.0.
v4.0.0
- Update to Qowaiv v8.0.0. (BREAKING)
v3.0.0
- Add .NET 10.0 target.
- Drop .NET9.0 targets. (BREAKING)
v2.0.1
- Hide assertion chain from stack trace.
v2.0.0
- Drop FluentAssertions depedency. (BREAKING)
- API change: model.ShouldBeValidFor<Validator>() => model.ValidateWith<Validator>().Should().BeValid() (BREAKING)
- Drop .NET standard 2.0. (BREAKING)
v1.0.0
- Add .NET 9.0 target.
- Drop .NET 5.0, NET6.0, NET7.0 targets. (BREAKING)
- Drop public Diagnostics.Contracts. BREAKING)
v0.3.0
- Support .NET 7.0. #62
v0.2.1
- Nullable anotations. #48
v0.1.1
- Use FluentAssertions to validate Result and Result<T> (#37)
v0.1.0
- Qowaiv.Validation.Abstractions dependency
v0.0.3
- FluentValidation 10.2.0 dependency.
v0.0.2
- ValidationMessageAssert.IsValid() returns the model (#20)