NewHeap.Platform.AI.Test 18.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NewHeap.Platform.AI.Test --version 18.0.0
                    
NuGet\Install-Package NewHeap.Platform.AI.Test -Version 18.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="NewHeap.Platform.AI.Test" Version="18.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NewHeap.Platform.AI.Test" Version="18.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NewHeap.Platform.AI.Test" />
                    
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 NewHeap.Platform.AI.Test --version 18.0.0
                    
#r "nuget: NewHeap.Platform.AI.Test, 18.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 NewHeap.Platform.AI.Test@18.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=NewHeap.Platform.AI.Test&version=18.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NewHeap.Platform.AI.Test&version=18.0.0
                    
Install as a Cake Tool

NewHeap.Platform.AI.Test

Reusable test support for consumers of NewHeap.Platform.AI.Common. The package contains deterministic IChatClient and embedding fakes, plus authorized and denied invocation gates, bounded ingestion sources, captured audit/usage sinks, and versioned fixtures that execute through Microsoft.Extensions.AI.Evaluation. Persisted fixture reports contain hashes, ratings and diagnostic counts rather than prompt, response, reason or diagnostic content. The package contains no test runner and no [Fact] or [Theory] tests.

OAuth authorization server for MCP connections

NhAiTestAuthorizationServer is an OAuth 2.1 authorization server on loopback for tests of MCP connections: metadata (RFC 8414 and OpenID Connect), authorization with scripted approval or denial, PKCE, the iss response parameter, refresh token rotation with reuse detection, client credentials, client_secret_basic, client_secret_post and private_key_jwt, dynamic registration, Client ID Metadata Documents and revocation. Access tokens are JWTs with the resource as audience. NhAiTestProtectedResource puts protected resource metadata (RFC 9728) and bearer validation in front of a test MCP server, with 401 challenges and 403 insufficient_scope for missing scopes:

await using var authorization = await NhAiTestAuthorizationServer.StartAsync();
authorization.RegisterClient("assistant", "client-secret");
var resource = new NhAiTestProtectedResource(authorization, mcpServerUrl, "/mcp");
app.Use((context, next) => resource.InvokeAsync(context, () => next(context)));

TokenRequests, Revocations, DynamicClients and Requests record what happened without tokens.

Scripted chat client

NhAiScriptedChatClient plays a fixed script of model responses so agent and assistant flows can be tested end to end without a model provider:

var model = new NhAiScriptedChatClient()
    .RespondWithFunctionCall("projects_search_v1", new { input = new { query = "roadmap", limit = 5 } })
    .RespondWithText("Two projects match the roadmap.");
services.AddKeyedSingleton<IChatClient>("project-assistant-chat-model", model);
  • Every response that follows a function call first verifies that the incoming messages contain a FunctionResultContent for each issued call id; the verified results are available through FunctionResults.
  • Streaming splits text into word chunks and ends with a UsageContent update with deterministic token counts; non-streaming returns the same response.
  • RespondWithProviderError("server_is_overloaded") fails a response inside its stream with an ErrorContent, after optional text, as a provider does when it is overloaded or out of quota after the response started. The stream ends there.
  • An exhausted script throws InvalidOperationException. Pass loop: true to restart the script instead, for example in a runnable sample host.
  • Requests records every received message list and the chat options.
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
36.0.0 0 11/6/2026
35.0.0 67 11/4/2026
34.0.0 77 11/4/2026
33.0.0 80 11/3/2026
32.0.0 99 11/2/2026
31.0.0 204 11/2/2026
30.0.0 141 11/1/2026
29.0.0 167 10/31/2026
28.0.0 110 10/30/2026
27.0.0 112 10/29/2026
26.0.0 97 10/29/2026
25.0.1 97 10/29/2026
25.0.0 94 10/29/2026
24.0.0 93 10/28/2026
23.0.1 108 10/28/2026
23.0.0 106 10/27/2026
22.0.0 110 10/26/2026
21.0.0 97 10/25/2026
20.0.0 99 10/24/2026
18.0.0 96 10/22/2026
Loading failed