Skip to content

Commit 95289a7

Browse files
committed
Update McpServerOptionsSetupTests to reflect new behavior
1 parent e0e7f04 commit 95289a7

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

tests/ModelContextProtocol.Tests/Configuration/McpServerOptionsSetupTests.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,29 +108,31 @@ public void Configure_WithUnsubscribeFromResourcesHandler_And_WithOtherResources
108108
}
109109

110110
[Fact]
111-
public void Configure_WithSubscribeToResourcesHandler_WithoutOtherResourcesHandler_DoesNotCreateResourcesCapability()
111+
public void Configure_WithSubscribeToResourcesHandler_WithoutOtherResourcesHandler_DoesCreateResourcesCapability()
112112
{
113113
var services = new ServiceCollection();
114114
services.AddMcpServer()
115115
.WithSubscribeToResourcesHandler(async (request, ct) => new EmptyResult());
116116

117117
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
118118

119-
Assert.Null(options.Handlers.SubscribeToResourcesHandler);
120-
Assert.Null(options.Capabilities?.Resources);
119+
Assert.NotNull(options.Handlers.SubscribeToResourcesHandler);
120+
Assert.NotNull(options.Capabilities?.Resources);
121+
Assert.True(options.Capabilities.Resources.Subscribe);
121122
}
122123

123124
[Fact]
124-
public void Configure_WithUnsubscribeFromResourcesHandler_WithoutOtherResourcesHandler_DoesNotCreateResourcesCapability()
125+
public void Configure_WithUnsubscribeFromResourcesHandler_WithoutOtherResourcesHandler_DoesCreateResourcesCapability()
125126
{
126127
var services = new ServiceCollection();
127128
services.AddMcpServer()
128129
.WithUnsubscribeFromResourcesHandler(async (request, ct) => new EmptyResult());
129130

130131
var options = services.BuildServiceProvider().GetRequiredService<IOptions<McpServerOptions>>().Value;
131132

132-
Assert.Null(options.Handlers.UnsubscribeFromResourcesHandler);
133-
Assert.Null(options.Capabilities?.Resources);
133+
Assert.NotNull(options.Handlers.UnsubscribeFromResourcesHandler);
134+
Assert.NotNull(options.Capabilities?.Resources);
135+
Assert.True(options.Capabilities.Resources.Subscribe);
134136
}
135137

136138
[Fact]

0 commit comments

Comments
 (0)