OrionLedger.Conformance 0.5.0

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

OrionLedger.Conformance

NuGet

A reusable xUnit conformance suite for OrionLedger IApiKeyStore implementations. Write a custom store over your database, derive one test class from ApiKeyStoreConformanceTests, supply a factory that returns a fresh store, and inherit the full battery of contract tests.

Part of the Orion family.

What it checks

Deriving from ApiKeyStoreConformanceTests runs facts that assert your store:

  • stores a record and finds it again by hash and by id, and returns null on a miss (not an error);
  • round-trips scopes exactly, including the empty set;
  • persists revocation, the rotation timestamps (SupersededAt, SupersededById, RetiresAt), and the last-used stamp and counter through UpdateAsync;
  • accumulates the last-used counter under sequential updates and, critically, does not lose counts under concurrent updates (50 parallel verifies must land a count of 50);
  • returns every record for a subject (including revoked ones) from FindBySubjectAsync, matches the subject case-sensitively, and returns an empty list for an unknown or empty subject.

Install

dotnet add package OrionLedger.Conformance

Add it to a test project alongside the xUnit runner packages (Microsoft.NET.Test.Sdk, xunit.runner.visualstudio).

Usage

using Moongazing.OrionLedger.Conformance;
using Moongazing.OrionLedger.Storage;

public sealed class MyStoreConformanceTests : ApiKeyStoreConformanceTests
{
    // Return a fresh, empty store per test. xUnit constructs the class once per fact, so each
    // test is isolated.
    protected override Task<IApiKeyStore> CreateStoreAsync()
        => Task.FromResult<IApiKeyStore>(new MyApiKeyStore(/* fresh backing store */));

    // Optional: release per-test resources (a connection, a temporary database, a dropped schema).
    protected override Task DisposeStoreAsync(IApiKeyStore store)
        => ((MyApiKeyStore)store).DisposeAsync().AsTask();
}

That single class gives you the whole contract suite. Use the protected NewRecord(...) helper if you want to add store-specific tests in the same class; it builds a valid ApiKeyRecord with a unique id and hash on each call.

Note on FindBySubjectAsync

FindBySubjectAsync is an optional part of the IApiKeyStore contract (it has a throwing default). The subject facts in this suite expect your store to override it. If your store intentionally does not support lookup by subject, do not derive the whole suite blindly; compose only the facts you support, or override the subject tests to assert NotSupportedException.

License

Licensed under the MIT License.

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
0.5.0 130 7/28/2026
0.4.0 113 7/20/2026