Nullean.Entities.CsCheck 0.1.0-preview.1

This is a prerelease version of Nullean.Entities.CsCheck.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Nullean.Entities.CsCheck --version 0.1.0-preview.1
                    
NuGet\Install-Package Nullean.Entities.CsCheck -Version 0.1.0-preview.1
                    
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="Nullean.Entities.CsCheck" Version="0.1.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nullean.Entities.CsCheck" Version="0.1.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="Nullean.Entities.CsCheck" />
                    
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 Nullean.Entities.CsCheck --version 0.1.0-preview.1
                    
#r "nuget: Nullean.Entities.CsCheck, 0.1.0-preview.1"
                    
#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 Nullean.Entities.CsCheck@0.1.0-preview.1
                    
#: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=Nullean.Entities.CsCheck&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Nullean.Entities.CsCheck&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Tool

Nullean.Entities.CsCheck

Test your domain from the rules you declare on it, on nine axes you have probably never considered. Built on CsCheck.

CsCheck is a very good property-testing library, and this package does not replace it. Every generator here is a CsCheck Gen<T>, every failure is a CsCheck failure (a shrunk case and a seed that replays it), and you can mix the two in one test class. If you are testing an algorithm or a pure function, use CsCheck on its own.

If you have a domain with rules (a total is never negative, cancelling twice is cancelling once, a confirmed order ships within a minute), this package turns those rules into tests.

What it adds to CsCheck

With plain CsCheck With this package
You write a generator for each type GenAuto builds one from the shape of the type, with hostile values (blank strings, NaN, undefined enums, duplicate ids) mixed in by default
You write a property for each rule You declare the rule (Idempotent, Monotonic, OrderIndependent, a deadline); its shape picks the property and the inputs
A property that passes A check that the generated data reached the rule; a rule never exercised fails as vacuous
Counter-examples you think of A counter-example per rule to show it can fire, found by search for most
Operations you list The operations of your type, discovered, with arguments harvested from the value they act on
No clock A virtual clock, and delays chosen from your deadlines

Read more: what this adds to CsCheck, with the same tests written both ways.

One screen

// the rules, declared once next to the type
[Constraints]
public static partial class OrderConstraints
{
	public static readonly Constraint<Order> CancelIsRepeatable = Constraints<Order>.Idempotent(o => o.Cancel());
	public static readonly Constraint<Order> VersionNeverGoesBack = Constraints<Order>.Monotonic(o => o.Version, MonotonicDirection.NonDecreasing);
}

// the tests: one per axis the rules declare
public static IEnumerable<Func<AxisCase>> Axes() => AutoTest.For(OrderConstraints.Instance, orders).AsDataSource();

[Test, MethodDataSource(nameof(Axes))]
public Task EveryDeclaredAxisHolds(AxisCase axis) => axis.RunAsync();

Install

dotnet add package Nullean.Entities.CsCheck   # tests only

The package does not depend on System.Reactive. If your service is built on IObservable<T>, add Nullean.Entities.CsCheck.Reactive.

Where to go next

License: MIT.

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 (3)

Showing the top 3 NuGet packages that depend on Nullean.Entities.CsCheck:

Package Downloads
Nullean.Entities.CsCheck.FileSystem

Generated file-system worlds for Nullean.Entities.CsCheck: AutoGen builds IFileSystem, IFileInfo and IDirectoryInfo members from one MockFileSystem per generated value, with missing, symlinked, hidden and outside-the-root files, so rules about files get counter-examples with no hand-written file system.

Nullean.Entities.CsCheck.Reactive

Rx scheduler scripts for Nullean.Entities.CsCheck: SampleWith, RunWith and SampleParallelWith drive a Script on a HistoricalScheduler and check Nullean.Entities.Reactive constraints. Opt-in; the default CsCheck package has no System.Reactive dependency.

Nullean.Entities.CsCheck.AutoBogus

An AutoBogus-backed CsCheck generator for Nullean.Entities.CsCheck: plausible Bogus data for any type, reproducible by seed and shrinkable, for teams that already configure AutoFaker.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 63 10/20/2026
0.1.0 92 10/20/2026
0.1.0-preview.2 63 10/20/2026
0.1.0-preview.1 60 10/20/2026