Masterly.BusinessRules.Testing
3.0.0
dotnet add package Masterly.BusinessRules.Testing --version 3.0.0
NuGet\Install-Package Masterly.BusinessRules.Testing -Version 3.0.0
<PackageReference Include="Masterly.BusinessRules.Testing" Version="3.0.0" />
<PackageVersion Include="Masterly.BusinessRules.Testing" Version="3.0.0" />
<PackageReference Include="Masterly.BusinessRules.Testing" />
paket add Masterly.BusinessRules.Testing --version 3.0.0
#r "nuget: Masterly.BusinessRules.Testing, 3.0.0"
#:package Masterly.BusinessRules.Testing@3.0.0
#addin nuget:?package=Masterly.BusinessRules.Testing&version=3.0.0
#tool nuget:?package=Masterly.BusinessRules.Testing&version=3.0.0
Masterly.BusinessRules.Testing
Test utilities for business rules: outcome coverage (which rules your tests saw both broken and passing), a boundary finder, CsCheck-backed property checks and smoke-test mutants.
This is a companion package of Masterly.BusinessRules, a composable business-rule engine for .NET.
Install
Add it to your test project:
dotnet add package Masterly.BusinessRules.Testing
- Target frameworks:
net8.0,net10.0(your test project must target .NET 8 or later) - Dependencies:
Masterly.BusinessRules, CsCheck 4.9.1 onnet8.0and 5.0.0 onnet10.0
Example
using Masterly.BusinessRules;
using Masterly.BusinessRules.Testing;
public sealed class OrderTotalLimitRule : BaseBusinessRule
{
private readonly decimal _orderTotal;
public OrderTotalLimitRule(decimal orderTotal) => _orderTotal = orderTotal;
public override string Code => "ORDER.TOTAL_LIMIT";
public override string Message => "The order total must not exceed 10,000.";
public override bool IsBroken() => _orderTotal > 10_000m;
}
public static class OrderRuleCoverage
{
public static void Run()
{
using RuleCoverageSession coverage = RuleCoverage.Begin();
BusinessRuleChecker.EvaluateAll(new OrderTotalLimitRule(12_500m).WithCoverage(coverage)); // broken
BusinessRuleChecker.EvaluateAll(new OrderTotalLimitRule(900m).WithCoverage(coverage)); // passed
RuleCoverageReport report = coverage.Report();
report.AssertMinimum(1.0); // throws RuleAssertionException when a rule was never broken or never passed
}
}
report.ToText() prints a per-rule table you can write to your test output.
Documentation
The boundary finder, property checks, mutants and the CsCheck version notes are covered in the full documentation: https://github.com/a7mdfre7at/Masterly.BusinessRules#readme
| 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 was computed. 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
- CsCheck (>= 5.0.0)
- Masterly.BusinessRules (>= 3.0.0)
-
net8.0
- CsCheck (>= 4.9.1)
- Masterly.BusinessRules (>= 3.0.0)
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.0 | 0 | 10/28/2026 |
Release notes for version 3.0.0: https://github.com/a7mdfre7at/Masterly.BusinessRules/blob/master/CHANGELOG.md