Skip to content

Commit ed0adcf

Browse files
committed
Restucture and add testing for .net8 and .net9
1 parent effa3ce commit ed0adcf

File tree

13 files changed

+81
-39
lines changed

13 files changed

+81
-39
lines changed

ModelContextProtocol.slnx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
<Folder Name="/tests/">
7171
<Project Path="tests/ModelContextProtocol.Analyzers.Tests/ModelContextProtocol.Analyzers.Tests.csproj" />
7272
<Project Path="tests/ModelContextProtocol.AspNetCore.Tests/ModelContextProtocol.AspNetCore.Tests.csproj" />
73+
<Project Path="tests/ModelContextProtocol.ConformanceServer/ModelContextProtocol.ConformanceServer.csproj" />
74+
<Project Path="tests/ModelContextProtocol.ConformanceTests/ModelContextProtocol.ConformanceTests.csproj" />
7375
<Project Path="tests/ModelContextProtocol.TestOAuthServer/ModelContextProtocol.TestOAuthServer.csproj" />
7476
<Project Path="tests/ModelContextProtocol.Tests/ModelContextProtocol.Tests.csproj" />
7577
<Project Path="tests/ModelContextProtocol.TestServer/ModelContextProtocol.TestServer.csproj" />

tests/ModelContextProtocol.ConformanceTests/ConformanceServer/ConformanceServer.csproj renamed to tests/ModelContextProtocol.ConformanceServer/ModelContextProtocol.ConformanceServer.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net10.0</TargetFramework>
4+
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<ProjectReference Include="../../../src/ModelContextProtocol.AspNetCore/ModelContextProtocol.AspNetCore.csproj" />
10+
<ProjectReference Include="../../src/ModelContextProtocol.AspNetCore/ModelContextProtocol.AspNetCore.csproj" />
1111
</ItemGroup>
1212

1313
</Project>

tests/ModelContextProtocol.ConformanceTests/ConformanceServer/ConformanceServer.http renamed to tests/ModelContextProtocol.ConformanceServer/ModelContextProtocol.ConformanceServer.http

File renamed without changes.

tests/ModelContextProtocol.ConformanceTests/ConformanceServer/Program.cs renamed to tests/ModelContextProtocol.ConformanceServer/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,6 @@ await ctx.Server.SampleAsync([
9494

9595
app.MapMcp();
9696

97+
app.MapGet("/health", () => TypedResults.Ok("Healthy"));
98+
9799
app.Run();

tests/ModelContextProtocol.ConformanceTests/ConformanceServer/Prompts/ConformancePrompts.cs renamed to tests/ModelContextProtocol.ConformanceServer/Prompts/ConformancePrompts.cs

File renamed without changes.

tests/ModelContextProtocol.ConformanceTests/ConformanceServer/Properties/launchSettings.json renamed to tests/ModelContextProtocol.ConformanceServer/Properties/launchSettings.json

File renamed without changes.

tests/ModelContextProtocol.ConformanceTests/ConformanceServer/Resources/ConformanceResources.cs renamed to tests/ModelContextProtocol.ConformanceServer/Resources/ConformanceResources.cs

File renamed without changes.

tests/ModelContextProtocol.ConformanceTests/ConformanceServer/Tools/ConformanceTools.cs renamed to tests/ModelContextProtocol.ConformanceServer/Tools/ConformanceTools.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ public static async Task<string> Sampling(
189189
Messages = [new SamplingMessage
190190
{
191191
Role = Role.User,
192-
Content = new TextContentBlock { Text = prompt },
192+
Content = [new TextContentBlock { Text = prompt }],
193193
}],
194194
MaxTokens = 100,
195195
Temperature = 0.7f
196196
};
197197

198198
var result = await server.SampleAsync(samplingParams, cancellationToken);
199-
return $"Sampling result: {(result.Content as TextContentBlock)?.Text ?? "No text content"}";
199+
return $"Sampling result: {(result.Content.FirstOrDefault() as TextContentBlock)?.Text ?? "No text content"}";
200200
}
201201
catch (Exception ex)
202202
{
@@ -279,7 +279,7 @@ public static async Task<string> ElicitationSep1034Defaults(
279279
Description = "Score",
280280
Default = 95.5
281281
},
282-
["status"] = new ElicitRequestParams.EnumSchema()
282+
["status"] = new ElicitRequestParams.UntitledSingleSelectEnumSchema()
283283
{
284284
Description = "Status",
285285
Enum = ["active", "inactive", "pending"],
@@ -331,12 +331,12 @@ public static async Task<string> ElicitationSep1330Enums(
331331
{
332332
Properties =
333333
{
334-
["color"] = new ElicitRequestParams.EnumSchema()
334+
["color"] = new ElicitRequestParams.UntitledSingleSelectEnumSchema()
335335
{
336336
Description = "Choose a color",
337337
Enum = ["red", "green", "blue"]
338338
},
339-
["size"] = new ElicitRequestParams.EnumSchema()
339+
["size"] = new ElicitRequestParams.UntitledSingleSelectEnumSchema()
340340
{
341341
Description = "Choose a size",
342342
Enum = ["small", "medium", "large"],

tests/ModelContextProtocol.ConformanceTests/ConformanceServer/appsettings.Development.json renamed to tests/ModelContextProtocol.ConformanceServer/appsettings.Development.json

File renamed without changes.

tests/ModelContextProtocol.ConformanceTests/ConformanceServer/appsettings.json renamed to tests/ModelContextProtocol.ConformanceServer/appsettings.json

File renamed without changes.

0 commit comments

Comments
 (0)