Skip to content

Commit b24fb15

Browse files
Ensure enums serialize as expected using defaults
1 parent e729a1c commit b24fb15

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

tests/ModelContextProtocol.Tests/Protocol/ProtocolTypeTests.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public static void ToolInputSchema_AcceptsValidSchemaDocuments(string validSchem
5656
[Theory]
5757
[InlineData(Role.User, "\"user\"")]
5858
[InlineData(Role.Assistant, "\"assistant\"")]
59-
public static void SerializeRole_Should_Be_Lower_Case(Role role, string expectedValue)
59+
public static void SerializeRole_ShouldBeCamelCased(Role role, string expectedValue)
6060
{
61-
var actualValue = JsonSerializer.Serialize(role, McpJsonUtilities.DefaultOptions);
61+
var actualValue = JsonSerializer.Serialize(role);
6262

6363
Assert.Equal(expectedValue, actualValue);
6464
}
@@ -72,9 +72,20 @@ public static void SerializeRole_Should_Be_Lower_Case(Role role, string expected
7272
[InlineData(LoggingLevel.Critical, "\"critical\"")]
7373
[InlineData(LoggingLevel.Alert, "\"alert\"")]
7474
[InlineData(LoggingLevel.Emergency, "\"emergency\"")]
75-
public static void SerializeLoggingLevel_Should_Be_Lower_Case(LoggingLevel level, string expectedValue)
75+
public static void SerializeLoggingLevel_ShouldBeCamelCased(LoggingLevel level, string expectedValue)
7676
{
77-
var actualValue = JsonSerializer.Serialize(level, McpJsonUtilities.DefaultOptions);
77+
var actualValue = JsonSerializer.Serialize(level);
78+
79+
Assert.Equal(expectedValue, actualValue);
80+
}
81+
82+
[Theory]
83+
[InlineData(ContextInclusion.None, "\"none\"")]
84+
[InlineData(ContextInclusion.ThisServer, "\"thisServer\"")]
85+
[InlineData(ContextInclusion.AllServers, "\"allServers\"")]
86+
public static void ContextInclusion_ShouldBeCamelCased(ContextInclusion level, string expectedValue)
87+
{
88+
var actualValue = JsonSerializer.Serialize(level);
7889

7990
Assert.Equal(expectedValue, actualValue);
8091
}

0 commit comments

Comments
 (0)