CSharpEssentials.Idempotency.Testing 7.0.0

dotnet add package CSharpEssentials.Idempotency.Testing --version 7.0.0
                    
NuGet\Install-Package CSharpEssentials.Idempotency.Testing -Version 7.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="CSharpEssentials.Idempotency.Testing" Version="7.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CSharpEssentials.Idempotency.Testing" Version="7.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CSharpEssentials.Idempotency.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 CSharpEssentials.Idempotency.Testing --version 7.0.0
                    
#r "nuget: CSharpEssentials.Idempotency.Testing, 7.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 CSharpEssentials.Idempotency.Testing@7.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=CSharpEssentials.Idempotency.Testing&version=7.0.0
                    
Install as a Cake Addin
#tool nuget:?package=CSharpEssentials.Idempotency.Testing&version=7.0.0
                    
Install as a Cake Tool

CSharpEssentials.Idempotency.Testing

xUnit contract tests for IIdempotencyRecordStore implementations from CSharpEssentials.Idempotency. Derive one class, return your store, and every scenario the built-in stores pass runs against it.

Installation

dotnet add package CSharpEssentials.Idempotency.Testing

Add it to an xUnit test project. Targets net11.0, net10.0, net9.0 and net8.0.

Usage

using CSharpEssentials.Idempotency;
using CSharpEssentials.Idempotency.Testing;

public sealed class RedisIdempotencyRecordStoreTests : IdempotencyRecordStoreContractTests
{
    protected override bool UseRealClock => true;

    protected override IIdempotencyRecordStore CreateStore(TimeProvider timeProvider) =>
        new RedisIdempotencyRecordStore(Connection);
}

The scenarios cover:

  • reserve, in flight, completed replay and fingerprint mismatch (in flight and completed);
  • release of an in-flight key, of a completed key, of an unknown key and with another token;
  • lease expiry, retention of completed payloads, and completion of an expired reservation that nobody took over;
  • a stale token fenced out by the next reservation, and a second completion keeping the first payload;
  • independent keys, namespaces and scopes, parts that differ only in case or by trailing spaces, global keys that never collide with scoped ones, and parts that contain separators;
  • empty and binary payloads, and a stored payload that does not change with the caller's buffer;
  • parallel reservations of a free key and of an expired key;
  • argument validation.

Options

Member Default Use
CreateStore(TimeProvider) abstract Returns the store under test. Called once per test.
UseRealClock false false passes a FakeTimeProvider and advances it. Return true for a store whose expiry runs on its own clock (Redis TTL, a database now()); the tests then use TimeProvider.System and wait.
IsReservationAtomic true Return false for a best-effort store: the parallel tests then accept more than one reservation but still require that every call is either reserved or in flight.
Lease, Retention, ExpirySlack 30 s, 1 h, 1 s (real clock: 1 s, 3 s, 500 ms) Durations used by the expiry tests.

Each test instance uses its own Namespace, so the scenarios can share one database or cache without cleanup. Test helpers (Key, ReserveAsync, AdvanceAsync, Payload, Store, Clock) are protected, so store-specific tests can live in the same class.

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.  net11.0 is compatible. 
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
7.0.0 0 10/20/2026