Make options types fully mutable (#107)

This commit is contained in:
Stephen Halter 2025-03-26 10:39:49 -07:00 • committed by GitHub
commit 95a017a03a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,7 +19,7 @@ public class SseServerIntegrationTests : LoggedTest, IClassFixture<SseServerInte
{
return McpClientFactory.CreateAsync(
_fixture.DefaultConfig,
options ?? _fixture.DefaultOptions,
options ?? SseServerIntegrationTestFixture.CreateDefaultClientOptions(),
loggerFactory: LoggerFactory);
}
@ -201,28 +201,22 @@ public class SseServerIntegrationTests : LoggedTest, IClassFixture<SseServerInte
// Set up the sampling handler
int samplingHandlerCalls = 0;
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
var options = _fixture.DefaultOptions with
var options = SseServerIntegrationTestFixture.CreateDefaultClientOptions();
options.Capabilities ??= new();
options.Capabilities.Sampling ??= new();
options.Capabilities.Sampling.SamplingHandler = async (_, _) =>
{
Capabilities = new()
samplingHandlerCalls++;
return new CreateMessageResult
{
Sampling = new()
Model = "test-model",
Role = "assistant",
Content = new Content
{
SamplingHandler = async (_, _) =>
{
samplingHandlerCalls++;
return new CreateMessageResult
{
Model = "test-model",
Role = "assistant",
Content = new Content
{
Type = "text",
Text = "Test response"
}
};
}
Type = "text",
Text = "Test response"
}
}
};
};
var client = await GetClientAsync(options);
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously