Audit protocol types (#892)
This commit is contained in:
parent
66c084c795
commit
121929da36
3 changed files with 262 additions and 168 deletions
|
|
@ -66,7 +66,7 @@ public class McpServerBuilderExtensionsFilterTests : ClientServerTestBase
|
|||
{
|
||||
return new CallToolResult
|
||||
{
|
||||
Content = [new TextContentBlock { Type = "text", Text = $"Error from filter: {ex.Message}" }],
|
||||
Content = [new TextContentBlock { Text = $"Error from filter: {ex.Message}" }],
|
||||
IsError = true
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public partial class McpServerBuilderExtensionsResourcesTests : ClientServerTest
|
|||
case "test://ResourceTemplate2":
|
||||
return new ReadResourceResult
|
||||
{
|
||||
Contents = [new TextResourceContents { Text = request.Params?.Uri ?? "(null)" }]
|
||||
Contents = [new TextResourceContents { Text = request.Params?.Uri ?? "(null)", Uri = request.Params?.Uri ?? "(null)" }]
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithListPromptsHandler(async (request, ct) => new ListPromptsResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.NotNull(options.Handlers.ListPromptsHandler);
|
||||
Assert.NotNull(options.Capabilities?.Prompts);
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithGetPromptHandler(async (request, ct) => new GetPromptResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.NotNull(options.Handlers.GetPromptHandler);
|
||||
Assert.NotNull(options.Capabilities?.Prompts);
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithListResourceTemplatesHandler(async (request, ct) => new ListResourceTemplatesResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.NotNull(options.Handlers.ListResourceTemplatesHandler);
|
||||
Assert.NotNull(options.Capabilities?.Resources);
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithListResourcesHandler(async (request, ct) => new ListResourcesResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.NotNull(options.Handlers.ListResourcesHandler);
|
||||
Assert.NotNull(options.Capabilities?.Resources);
|
||||
}
|
||||
|
|
@ -70,7 +70,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithReadResourceHandler(async (request, ct) => new ReadResourceResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.NotNull(options.Handlers.ReadResourceHandler);
|
||||
Assert.NotNull(options.Capabilities?.Resources);
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithSubscribeToResourcesHandler(async (request, ct) => new EmptyResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.NotNull(options.Handlers.ListResourcesHandler);
|
||||
Assert.NotNull(options.Handlers.SubscribeToResourcesHandler);
|
||||
Assert.NotNull(options.Capabilities?.Resources);
|
||||
|
|
@ -100,7 +100,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithUnsubscribeFromResourcesHandler(async (request, ct) => new EmptyResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.NotNull(options.Handlers.ListResourcesHandler);
|
||||
Assert.NotNull(options.Handlers.UnsubscribeFromResourcesHandler);
|
||||
Assert.NotNull(options.Capabilities?.Resources);
|
||||
|
|
@ -115,7 +115,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithSubscribeToResourcesHandler(async (request, ct) => new EmptyResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.Null(options.Handlers.SubscribeToResourcesHandler);
|
||||
Assert.Null(options.Capabilities?.Resources);
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithUnsubscribeFromResourcesHandler(async (request, ct) => new EmptyResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.Null(options.Handlers.UnsubscribeFromResourcesHandler);
|
||||
Assert.Null(options.Capabilities?.Resources);
|
||||
}
|
||||
|
|
@ -233,7 +233,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithListToolsHandler(async (request, ct) => new ListToolsResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.NotNull(options.Handlers.ListToolsHandler);
|
||||
Assert.NotNull(options.Capabilities?.Tools);
|
||||
}
|
||||
|
|
@ -246,7 +246,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithCallToolHandler(async (request, ct) => new CallToolResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.NotNull(options.Handlers.CallToolHandler);
|
||||
Assert.NotNull(options.Capabilities?.Tools);
|
||||
}
|
||||
|
|
@ -261,7 +261,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithSetLoggingLevelHandler(async (request, ct) => new EmptyResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.NotNull(options.Handlers.SetLoggingLevelHandler);
|
||||
Assert.NotNull(options.Capabilities?.Logging);
|
||||
}
|
||||
|
|
@ -276,7 +276,7 @@ public class McpServerOptionsSetupTests
|
|||
.WithCompleteHandler(async (request, ct) => new CompleteResult());
|
||||
|
||||
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
|
||||
|
||||
|
||||
Assert.NotNull(options.Handlers.CompleteHandler);
|
||||
Assert.NotNull(options.Capabilities?.Completions);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue