ZeroMcp.TestKit.Xunit
0.1.3.4
dotnet add package ZeroMcp.TestKit.Xunit --version 0.1.3.4
NuGet\Install-Package ZeroMcp.TestKit.Xunit -Version 0.1.3.4
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="ZeroMcp.TestKit.Xunit" Version="0.1.3.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZeroMcp.TestKit.Xunit" Version="0.1.3.4" />
<PackageReference Include="ZeroMcp.TestKit.Xunit" />
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 ZeroMcp.TestKit.Xunit --version 0.1.3.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ZeroMcp.TestKit.Xunit, 0.1.3.4"
#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 ZeroMcp.TestKit.Xunit@0.1.3.4
#: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=ZeroMcp.TestKit.Xunit&version=0.1.3.4
#tool nuget:?package=ZeroMcp.TestKit.Xunit&version=0.1.3.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ZeroMcp.TestKit.Xunit
xUnit integration for ZeroMcp.TestKit — test MCP (Model Context Protocol) servers with first-class Visual Studio Test Explorer support.
Install
dotnet add package ZeroMcp.TestKit.Xunit
This package depends on ZeroMcp.TestKit (installed automatically).
Attributes
[McpFact]
Marks a test as an MCP server test. Inherits from xUnit's [Fact].
using ZeroMcp.TestKit;
using ZeroMcp.TestKit.Xunit;
public class MyMcpServerTests
{
[McpFact(DisplayName = "search returns valid schema")]
public async Task SearchToolSchemaValid()
{
await McpTest
.Server("http://localhost:8000/mcp")
.Tool("search")
.WithParams(new { query = "hello" })
.ExpectSchemaMatch()
.RunAsync();
}
}
[McpTheory]
Parameterized MCP tests. Inherits from xUnit's [Theory].
[McpTheory(DisplayName = "Lookup tools return valid schema")]
[InlineData("get_customer", 1)]
[InlineData("get_product", 1)]
[InlineData("get_order", 1)]
public async Task LookupById_SchemaValid(string toolName, int id)
{
await McpTest
.Server("http://localhost:8000/mcp")
.Tool(toolName)
.WithParams(new { id })
.ExpectSchemaMatch()
.RunAsync();
}
McpAssert — Static Assertion Helpers
var result = await McpTest
.Server("http://localhost:8000/mcp")
.Tool("search").WithParams(new { query = "hi" })
.RunWithoutThrowAsync();
McpAssert.Passed(result);
McpAssert.ToolPassed(result, "search");
McpAssert.SchemaValid(result, "search");
McpAssert.Deterministic(result, "search");
McpAssert.ResponseHasProperty(result, "search", "name");
McpAssert.ResponseContains(result, "search", "name", "Alice");
Fluent Assertion Chains
Scope to a specific tool with ForTool(), then chain assertions:
var result = await McpTest
.Server("http://localhost:8000/mcp")
.Tool("get_customer").WithParams(new { id = 1 })
.RunWithoutThrowAsync();
result.ForTool("get_customer")
.Passed()
.HasValidSchema()
.HasReturnProperty("id")
.HasReturnProperty("name")
.HasReturnValue("email", "alice@example.com");
Available Fluent Methods
| Method | Asserts |
|---|---|
.Passed() |
Tool test passed |
.Failed() |
Tool test failed |
.HasToolName(name) |
Tool name matches |
.HasValidSchema() |
Schema validation passed |
.IsDeterministic() |
Determinism check passed |
.HasReturnProperty(path) |
Response payload contains the property |
.HasReturnValue(path, value) |
Response payload property equals the value |
Links
| Product | Versions 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 was computed. 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 was computed. 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.
-
net8.0
- xunit.assert (>= 2.9.3)
- xunit.core (>= 2.9.3)
- ZeroMcp.TestKit (>= 0.1.3.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial preview release — McpFact, McpTheory, McpAssert, and fluent assertion extensions.