Add net10.0 assets and run some fixers (#875)

This commit is contained in:
Stephen Toub 2025-10-15 15:27:43 -04:00 • committed by GitHub
commit bfc0980ef5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 168 additions and 194 deletions

View file

@ -88,7 +88,7 @@ public class DiagnosticTests
{
await client.CallToolAsync("Throw", cancellationToken: TestContext.Current.CancellationToken);
await Assert.ThrowsAsync<McpProtocolException>(async () => await client.CallToolAsync("does-not-exist", cancellationToken: TestContext.Current.CancellationToken));
}, new List<string>());
}, []);
}
Assert.NotEmpty(activities);

View file

@ -13,7 +13,7 @@ public static class IconTests
{
Source = "https://example.com/icon.png",
MimeType = "image/png",
Sizes = new List<string> { "48x48" },
Sizes = ["48x48"],
Theme = "light"
};
@ -61,7 +61,7 @@ public static class IconTests
{
Source = "https://example.com/icon.svg",
MimeType = "image/svg+xml",
Sizes = new List<string> { "any" },
Sizes = ["any"],
Theme = "dark"
};

View file

@ -16,8 +16,8 @@ public static class ImplementationTests
Version = "1.0.0",
Icons =
[
new() { Source = "https://example.com/icon.png", MimeType = "image/png", Sizes = new List<string> { "48x48" } },
new() { Source = "https://example.com/icon.svg", MimeType = "image/svg+xml", Sizes = new List<string> { "any" } }
new() { Source = "https://example.com/icon.png", MimeType = "image/png", Sizes = ["48x48"] },
new() { Source = "https://example.com/icon.svg", MimeType = "image/svg+xml", Sizes = ["any"] }
],
WebsiteUrl = "https://example.com"
};

View file

@ -16,7 +16,7 @@ public static class PromptTests
Description = "Review the provided code",
Icons =
[
new() { Source = "https://example.com/review-icon.svg", MimeType = "image/svg+xml", Sizes = new List<string> { "any" } }
new() { Source = "https://example.com/review-icon.svg", MimeType = "image/svg+xml", Sizes = ["any"] }
],
Arguments =
[

View file

@ -19,7 +19,7 @@ public static class ResourceTests
Size = 1024,
Icons =
[
new() { Source = "https://example.com/pdf-icon.png", MimeType = "image/png", Sizes = new List<string> { "32x32" } }
new() { Source = "https://example.com/pdf-icon.png", MimeType = "image/png", Sizes = ["32x32"] }
],
Annotations = new Annotations { Audience = [Role.User] }
};
@ -86,7 +86,7 @@ public static class ResourceTests
Description = "A test resource",
MimeType = "text/plain",
Size = 512,
Icons = new List<Icon> { new() { Source = "https://example.com/icon.svg" } },
Icons = [new() { Source = "https://example.com/icon.svg" }],
Annotations = new Annotations { Audience = [Role.User] }
};

View file

@ -16,7 +16,7 @@ public static class ToolTests
Description = "Get current weather information",
Icons =
[
new() { Source = "https://example.com/weather.png", MimeType = "image/png", Sizes = new List<string> { "48x48" } }
new() { Source = "https://example.com/weather.png", MimeType = "image/png", Sizes = ["48x48"] }
],
Annotations = new ToolAnnotations
{

View file

@ -498,7 +498,7 @@ public class McpServerPromptTests
{
var icons = new List<Icon>
{
new() { Source = "https://example.com/prompt-icon.png", MimeType = "image/png", Sizes = new List<string> { "48x48" } }
new() { Source = "https://example.com/prompt-icon.png", MimeType = "image/png", Sizes = ["48x48"] }
};
McpServerPrompt prompt = McpServerPrompt.Create(() => "test prompt", new McpServerPromptCreateOptions

View file

@ -307,7 +307,7 @@ public partial class McpServerResourceTests
{
McpServerResource t1 = McpServerResource.Create(() => "resource", new() { UriTemplate = "resource://MyCoolResource" });
McpServerResource t2 = McpServerResource.Create(() => "resource", new() { UriTemplate = "resource://MyCoolResource2" });
McpServerResourceCollection collection = new() { t1, t2 };
McpServerResourceCollection collection = [t1, t2];
Assert.True(collection.TryGetPrimitive("resource://mycoolresource", out McpServerResource? result));
Assert.Same(t1, result);
}
@ -537,7 +537,7 @@ public partial class McpServerResourceTests
McpServerResource resource = McpServerResource.Create((McpServer server) =>
{
Assert.Same(mockServer.Object, server);
return new ReadResourceResult { Contents = new List<ResourceContents> { new TextResourceContents { Text = "hello" } } };
return new ReadResourceResult { Contents = [new TextResourceContents { Text = "hello" }] };
}, new() { Name = "Test" });
var result = await resource.ReadAsync(
new RequestContext<ReadResourceRequestParams>(mockServer.Object, CreateTestJsonRpcRequest()) { Params = new() { Uri = "resource://mcp/Test" } },
@ -682,7 +682,7 @@ public partial class McpServerResourceTests
{
var icons = new List<Icon>
{
new() { Source = "https://example.com/resource-icon.png", MimeType = "image/png", Sizes = new List<string> { "32x32" } }
new() { Source = "https://example.com/resource-icon.png", MimeType = "image/png", Sizes = ["32x32"] }
};
McpServerResource resource = McpServerResource.Create(() => "test content", new McpServerResourceCreateOptions

View file

@ -413,7 +413,7 @@ public partial class McpServerToolTests
{
CallToolResult response = new()
{
Content = new List<ContentBlock> { new TextContentBlock { Text = "text" }, new ImageContentBlock { Data = "1234", MimeType = "image/png" } }
Content = [new TextContentBlock { Text = "text" }, new ImageContentBlock { Data = "1234", MimeType = "image/png" }]
};
Mock<McpServer> mockServer = new();
@ -683,8 +683,8 @@ public partial class McpServerToolTests
{
var icons = new List<Icon>
{
new() { Source = "https://example.com/icon.png", MimeType = "image/png", Sizes = new List<string> { "48x48" } },
new() { Source = "https://example.com/icon.svg", MimeType = "image/svg+xml", Sizes = new List<string> { "any" } }
new() { Source = "https://example.com/icon.png", MimeType = "image/png", Sizes = ["48x48"] },
new() { Source = "https://example.com/icon.svg", MimeType = "image/svg+xml", Sizes = ["any"] }
};
McpServerTool tool = McpServerTool.Create(() => "test", new McpServerToolCreateOptions