Ocrx.Sdk.Testing 2.4.1

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

OCRX.Sdk.Testing

The testing companion to Ocrx.Sdk, in the shape of Microsoft.AspNetCore.Mvc.Testing: a public surface for driving a plugin under test, so a plugin in its own repository needs no InternalsVisibleTo from the SDK.

Two layers. TickDataBuilder and FakePluginServices cover unit tests — no engine, no OCR, no game. ReplayHarness covers parity: it spawns a real Ocrx.Engine.exe replaying a PNG corpus and drives the plugin through its real OcrxPluginHost path, which is what a plugin's CI runs.

Install

dotnet add package Ocrx.Sdk.Testing

The first OCRX package train is version 2.0.0.

Unit test

var plugin = new CounterPlugin();
var services = new FakePluginServices();
var tick = new TickDataBuilder().Text("counter", "4/8").Build();

await plugin.OnTickAsync(TickContext.ForTesting(tick, services), default);

Assert.Equal("4/8", Assert.Single(services.Emitted).RawText);

The builder produces a tick the way the engine would have sent it — through the SDK's own wire mapping — so a tick that could never arrive on the wire cannot pass a test. It covers .Text, .Detailed, .Pixels, .Errored, plus .Manual(), .FrameSeq(n), and .At(instant).

Parity test

var result = await ReplayHarness.RunAsync(new ReplayOptions
{
    EnginePath = EngineLocator.Resolve(),
    CorpusDir = ReplayCorpus.Resolve("Fixtures/Replay/my-corpus"),
    Plugin = new CounterPlugin(),
});

Assert.Equal(StreamEndReason.ReplayCompleted, result.Reason);

EngineLocator.Resolve() honours OCRX_ENGINE_PATH and otherwise uses the current per-user OCRX installation. Corpus layout and capture: docs/REPLAY.md.

Parity test against a video

Set VideoPath instead of CorpusDir to drive the same run from an MP4 (--video, TASK-25) — one file standing in for a long session that would be thousands of PNGs. Set exactly one of the two; RunAsync throws if both or neither is set.

var result = await ReplayHarness.RunAsync(new ReplayOptions
{
    EnginePath = EngineLocator.Resolve(),
    VideoPath = ReplayCorpus.Resolve("Fixtures/Replay/my-clip/session.mp4"),
    VideoFps = 2,   // optional; null leaves the engine on its own 1000/ScanIntervalMs default
    Plugin = new CounterPlugin(),
});

Assert.Equal(StreamEndReason.ReplayCompleted, result.Reason);

The harness only ever drives the deterministic drain — it never asks for --video-realtime or --video-loop, which exist for interactive dev against a live engine, not an automated assertion.

Product Compatible and additional computed target framework versions.
.NET 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
2.4.1 0 9/16/2026
2.4.0 42 9/15/2026
2.3.0 69 9/14/2026
2.2.0 72 9/14/2026
2.1.1 82 9/14/2026
2.1.0 142 9/11/2026
2.0.0 115 9/7/2026