Switchknife.Facts.Testing 0.1.0

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

Switchknife.Facts.Testing

Test doubles for Switchknife.Facts, so code that extracts facts from conversations can be tested without calling a model. No dependency beyond Switchknife.Facts and none on a test framework. Native AOT compatible.

var extractor = new ScriptedExtractor(
    """{"facts":[{"subject":{"ref":"e1","name":null,"kind":null},"predicate":"likes","value":"jazz","object":null,"text":"Anna likes jazz.","validFrom":"2026-05-01","validTo":null,"replaces":null,"evidence":["l1"],"quote":"like jazz","salience":0.8}]}""",
    new TimeoutException("the model did not answer"));

var first = await store.ExtractAsync(extractor, episode, context);   // the reply goes through the full pipeline
Assert.Equal(ExtractionStatus.Ingested, first.Status);

var second = await store.ExtractAsync(extractor, otherEpisode, context);   // the error becomes a failed episode
Assert.Equal(2, extractor.Calls);
Assert.Contains("[l1] Anna:", extractor.Requests[0].Prompt.User);
  • new ScriptedExtractor(step, step, ...): the n-th call runs the n-th step; when the steps run out, the last one keeps answering. A string is a model reply (reported as model scripted), an ExtractorResponse is returned as given (to set the extractor name, model and token counts), an Exception is thrown.
  • new ScriptedExtractor(async token => response): answers every call; wait on the token to simulate a hanging model that only a timeout or cancellation ends.
  • Calls and Requests: how many calls and each ExtractionRequest (prompt and context) in arrival order, to assert on what the pipeline sent. Recording is thread-safe.
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
0.1.0 83 10/28/2026