TestBucket.AI.Xunit
0.0.1
See the version list below for details.
dotnet add package TestBucket.AI.Xunit --version 0.0.1
NuGet\Install-Package TestBucket.AI.Xunit -Version 0.0.1
<PackageReference Include="TestBucket.AI.Xunit" Version="0.0.1" />
<PackageVersion Include="TestBucket.AI.Xunit" Version="0.0.1" />
<PackageReference Include="TestBucket.AI.Xunit" />
paket add TestBucket.AI.Xunit --version 0.0.1
#r "nuget: TestBucket.AI.Xunit, 0.0.1"
#addin nuget:?package=TestBucket.AI.Xunit&version=0.0.1
#tool nuget:?package=TestBucket.AI.Xunit&version=0.0.1
MCP test extensions for xunit v3
The TestBucket.McpTest.Xunit
package provides helpers for writing integration tests against Model Context Protocol (MCP) servers using xUnit v3. It is designed to work with the IMcpClient
interface and the McpClientFactory
from the ModelContextProtocol
library.
Getting Started
Add Package Reference
Ensure your test project references the following NuGet packages:
TestBucket.McpTest.Xunit
ModelContextProtocol.Core
xunit.v3.assert
xunit.v3.extensibility.core
Create an MCP Client
Use
McpClientFactory
to create anIMcpClient
instance. Typically, you will need to provide a transport (e.g.,SseClientTransport
) and authentication headers (if needed).
Example
[Fact]
public async Task Should_Invoke_MyTool_Successfully()
{
// Arrange: create your IMcpClient (using your factory or fixture)
IMcpClient client = /* get or create your client, e.g. from a fixture */;
// Tool name and arguments
string toolName = "myTool";
var arguments = new Dictionary<string, object?>
{
{ "param1", "value1" },
{ "param2", 42 }
};
// Act: call the tool
var response = await client.TestCallToolAsync(
toolName,
arguments,
progress: null, // or provide a progress reporter if needed
jsonSerializerOptions: new JsonSerializerOptions { PropertyNameCaseInsensitive = true }
);
// Assert: check the response
response.ShouldBeSuccess();
response.ShouldHaveContent();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 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. |
-
net9.0
- Microsoft.Extensions.AI (>= 9.6.0)
- Microsoft.Extensions.DependencyInjection (>= 9.0.6)
- ModelContextProtocol.Core (>= 0.2.0-preview.3)
- OllamaSharp (>= 5.2.2)
- TestBucket.Traits.Xunit (>= 1.0.3)
- Testcontainers.Ollama (>= 4.5.0)
- xunit.v3.assert (>= 2.0.3)
- xunit.v3.extensibility.core (>= 2.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.