Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion plugins/dotnet-ai/skills/mcp-csharp-test/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public class ApiToolTests

### Step 3: Write integration tests with MCP client

Test the full MCP protocol using a client-server connection:
Test the full MCP protocol through a real MCP client.

> **Default to in-memory testing.** Use the SDK's `ClientServerTestBase` (see [references/test-patterns.md](references/test-patterns.md)) — it wires client and server in-process, so tests are fast and deterministic with no spawned process. Reserve the process-spawning `StdioClientTransport` below for **one** end-to-end smoke test, not your whole suite — spawning `dotnet run` per fixture is the #1 cause of flaky, hanging integration tests.

```csharp
Comment on lines +96 to 100
using ModelContextProtocol.Client;
Expand Down Expand Up @@ -122,6 +124,14 @@ public class ServerIntegrationTests : IAsyncLifetime
tools.Should().Contain(t => t.Name == "echo");
}

[Fact]
public async Task Tools_AllHaveDescriptions()
{
// MCP clients rely on descriptions to choose tools — enforce they exist.
var tools = await _client.ListToolsAsync();
tools.Should().OnlyContain(t => !string.IsNullOrWhiteSpace(t.Description));
Comment on lines +131 to +132
}

[Fact]
public async Task Tool_ReturnsExpectedResult()
{
Expand Down Expand Up @@ -160,7 +170,9 @@ For the evaluation format, example questions, and detailed guidance, see [refere
## Validation

- [ ] Unit tests cover all tool methods, including edge cases
- [ ] Integration tests use in-memory `ClientServerTestBase` (process-spawning limited to one E2E smoke test)
- [ ] Integration tests verify tool listing via `ListToolsAsync()`
- [ ] Every tool exposes a non-empty `Description` (asserted in a test)
- [ ] Integration tests verify tool invocation via `CallToolAsync()`
- [ ] All tests pass: `dotnet test`
- [ ] Tests run in CI without manual setup
Expand Down