Styling: remove a few redundant parens from object initializer expressions. (#548)

* Styling: remove a few redundant parens from object initializer expressions.

* Fix build error.
This commit is contained in:
Eirik Tsarpalis 2025-06-26 16:55:54 +03:00 • committed by GitHub
commit 55bda787ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 108 additions and 108 deletions

View file

@ -15,7 +15,7 @@ public partial class McpClientResourceTemplateTests : ClientServerTestBase
protected override void ConfigureServices(ServiceCollection services, IMcpServerBuilder mcpServerBuilder)
{
mcpServerBuilder.WithReadResourceHandler((request, cancellationToken) =>
new ValueTask<ReadResourceResult>(new ReadResourceResult()
new ValueTask<ReadResourceResult>(new ReadResourceResult
{
Contents = [new TextResourceContents { Text = request.Params?.Uri ?? string.Empty }]
}));

View file

@ -69,7 +69,7 @@ public partial class McpServerBuilderExtensionsPromptsTests : ClientServerTestBa
case "FirstCustomPrompt":
case "SecondCustomPrompt":
case "FinalCustomPrompt":
return new GetPromptResult()
return new GetPromptResult
{
Messages = [new() { Role = Role.User, Content = new TextContentBlock { Text = $"hello from {request.Params.Name}" } }],
};

View file

@ -99,7 +99,7 @@ public partial class McpServerBuilderExtensionsResourcesTests : ClientServerTest
case "test://Resource3":
case "test://ResourceTemplate1":
case "test://ResourceTemplate2":
return new ReadResourceResult()
return new ReadResourceResult
{
Contents = [new TextResourceContents { Text = request.Params?.Uri ?? "(null)" }]
};

View file

@ -95,7 +95,7 @@ public partial class McpServerBuilderExtensionsToolsTests : ClientServerTestBase
case "FirstCustomTool":
case "SecondCustomTool":
case "FinalCustomTool":
return new CallToolResult()
return new CallToolResult
{
Content = [new TextContentBlock { Text = $"{request.Params.Name}Result" }],
};
@ -671,7 +671,7 @@ public partial class McpServerBuilderExtensionsToolsTests : ClientServerTestBase
await client.SendNotificationAsync(
NotificationMethods.CancelledNotification,
parameters: new CancelledNotificationParams()
parameters: new CancelledNotificationParams
{
RequestId = requestId,
},

View file

@ -27,25 +27,25 @@ public partial class ElicitationTests : ClientServerTestBase
{
Properties = new Dictionary<string, ElicitRequestParams.PrimitiveSchemaDefinition>()
{
["prop1"] = new ElicitRequestParams.StringSchema()
["prop1"] = new ElicitRequestParams.StringSchema
{
Title = "title1",
MinLength = 1,
MaxLength = 100,
},
["prop2"] = new ElicitRequestParams.NumberSchema()
["prop2"] = new ElicitRequestParams.NumberSchema
{
Description = "description2",
Minimum = 0,
Maximum = 1000,
},
["prop3"] = new ElicitRequestParams.BooleanSchema()
["prop3"] = new ElicitRequestParams.BooleanSchema
{
Title = "title3",
Description = "description4",
Default = true,
},
["prop4"] = new ElicitRequestParams.EnumSchema()
["prop4"] = new ElicitRequestParams.EnumSchema
{
Enum = ["option1", "option2", "option3"],
EnumNames = ["Name1", "Name2", "Name3"],
@ -57,9 +57,9 @@ public partial class ElicitationTests : ClientServerTestBase
Assert.Equal("accept", result.Action);
return new CallToolResult()
return new CallToolResult
{
Content = [new TextContentBlock() { Text = "success" }],
Content = [new TextContentBlock { Text = "success" }],
};
});
}
@ -67,7 +67,7 @@ public partial class ElicitationTests : ClientServerTestBase
[Fact]
public async Task Can_Elicit_Information()
{
await using IMcpClient client = await CreateMcpClientForServer(new McpClientOptions()
await using IMcpClient client = await CreateMcpClientForServer(new McpClientOptions
{
Capabilities = new()
{

View file

@ -571,7 +571,7 @@ public partial class McpServerResourceTests
McpServerResource resource = McpServerResource.Create((IMcpServer server) =>
{
Assert.Same(mockServer.Object, server);
return new List<AIContent>()
return new List<AIContent>
{
new TextContent("hello!"),
new DataContent(new byte[] { 4, 5, 6 }, "application/json"),

View file

@ -586,7 +586,7 @@ public class McpServerTests : LoggedTest
await using var transport = new TestServerTransport();
await using var server = McpServerFactory.Create(transport, _options, LoggerFactory);
var logNotification = new JsonRpcNotification()
var logNotification = new JsonRpcNotification
{
Method = NotificationMethods.LoggingMessageNotification
};