Masterly.NonEmptyList.Testing
3.0.1
dotnet add package Masterly.NonEmptyList.Testing --version 3.0.1
NuGet\Install-Package Masterly.NonEmptyList.Testing -Version 3.0.1
<PackageReference Include="Masterly.NonEmptyList.Testing" Version="3.0.1" />
<PackageVersion Include="Masterly.NonEmptyList.Testing" Version="3.0.1" />
<PackageReference Include="Masterly.NonEmptyList.Testing" />
paket add Masterly.NonEmptyList.Testing --version 3.0.1
#r "nuget: Masterly.NonEmptyList.Testing, 3.0.1"
#:package Masterly.NonEmptyList.Testing@3.0.1
#addin nuget:?package=Masterly.NonEmptyList.Testing&version=3.0.1
#tool nuget:?package=Masterly.NonEmptyList.Testing&version=3.0.1
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 | Versions 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. |
-
net10.0
- AutoFixture (>= 4.18.1)
- CsCheck (>= 4.9.1)
- Masterly.NonEmptyList (>= 3.0.1)
-
net8.0
- AutoFixture (>= 4.18.1)
- CsCheck (>= 4.9.1)
- Masterly.NonEmptyList (>= 3.0.1)
-
net9.0
- AutoFixture (>= 4.18.1)
- CsCheck (>= 4.9.1)
- Masterly.NonEmptyList (>= 3.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v3.0.1:
- New package icon: a pair of brackets around a single element
v3.0.0:
- Initial release: NonEmptyGen (CsCheck), NonEmptyCustomization (AutoFixture), NonEmptyListLaws