Masterly.NonEmptyList.Testing 3.0.0

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

Masterly.NonEmptyList.Testing

Test support for Masterly.NonEmptyList: CsCheck generators, an AutoFixture customization and the published law suite.

Installation

dotnet add package Masterly.NonEmptyList.Testing

CsCheck generators

Every generator yields at least one element, so properties never need an empty guard.

using CsCheck;
using Masterly.NonEmptyList.Testing;

NonEmptyGen.List(Gen.Int).Sample(xs => xs.Map(x => x) == xs);
NonEmptyGen.Sorted(Gen.Int).Sample(xs => xs.Head <= xs.Last);
NonEmptyGen.Constrained<int, AtLeast<Two>>(Gen.Int, minCount: 2).Sample(xs => xs.Second() == xs[1]);
NonEmptyGen.String().Sample(s => !string.IsNullOrWhiteSpace(s.Value));

Available: List, Immutable, Set, Dictionary, Constrained, Sorted, Distinct, String, EventStream, Zipper, Tree, Validation.

AutoFixture

IFixture fixture = new Fixture().Customize(new NonEmptyCustomization());

Order order = fixture.Create<Order>();   // NonEmptyList, NonEmptySet, NonEmptyString, ConstrainedList properties all populated

Generated [NonEmptyCollection] classes resolve too. Constrained types are shrunk until their constraint holds.

Laws

NonEmptyListLaws exposes the functor, monad, fold and structural laws as boolean functions, plus CheckAll(xs) which returns the names of any laws that fail. Use them to verify your own extension methods or forks:

NonEmptyGen.List(Gen.Int).Sample(xs => NonEmptyListLaws.CheckAll(xs).Count == 0);
NonEmptyGen.List(Gen.Int).Sample(xs => NonEmptyListLaws.MapComposition(xs, x => x + 1, x => x * 2));

Documentation

Full guide: https://a7mdfre7at.github.io/Masterly.NonEmptyList/docs/testing.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
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
3.0.1 95 11/2/2026
3.0.0 88 11/2/2026

v3.0.0:
- Initial release: NonEmptyGen (CsCheck), NonEmptyCustomization (AutoFixture), NonEmptyListLaws