Skip to content

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.

Testing Contracts & Mutation Testing

Under Principle 12 (Tests are executable contracts), tests in EricksonLopez.* serve as living behavioral specifications that appear directly in CI telemetry and Stryker.NET mutation testing reports.

Every unit, integration, concurrency, and security test method follows:

[UnitOfWork]_[ScenarioUnderTest]_[ExpectedBehavior]

Test projects intentionally suppress CA1707 and IDE1006 so semantic underscores remain clean under <TreatWarningsAsErrors>true</TreatWarningsAsErrors>:

<PropertyGroup Condition="$(MSBuildProjectDirectory.Contains('tests'))">
<NoWarn>$(NoWarn);CA1707;IDE1006</NoWarn>
</PropertyGroup>
using EricksonLopez.Result;
using EricksonLopez.Result.Testing;
using Xunit;
namespace Example.Domain.UnitTests;
public sealed class OrderValidationTests
{
[Fact]
public void Create_WhenTotalIsNonPositive_ReturnsValidationFailure()
{
// Arrange
decimal invalidTotal = 0m;
// Act
Result result = invalidTotal <= 0m
? Result.Failure(Error.Validation("Order.InvalidTotal", "Total must exceed zero."))
: Result.Success();
// Assert
result.ShouldBeFailure();
result.ShouldHaveErrorCode("Order.InvalidTotal");
result.ShouldHaveErrorType(ErrorType.Validation);
}
}
  1. 1:1 Project Symmetry: Every src/ assembly pairs with a dedicated unit test suite.
  2. Concurrency & Race Validation: CAS, idempotency claims, key ring cache invalidation, and distributed locks include concurrent stress tests.
  3. Security Threat Suites: dotnet-security and dotnet-xml enforce adversarial tests for timing attacks, memory zeroing, SSRF, and XXE prevention.
  4. Mutation Testing (Stryker.NET): Verifies that assertions kill logical, arithmetic, and boundary mutants rather than merely inflating line coverage.