|
1 | 1 | using ModelContextProtocol.Protocol.Types;
|
| 2 | +using ModelContextProtocol.Utils.Json; |
2 | 3 | using System.Text.Json;
|
3 | 4 |
|
4 | 5 | namespace ModelContextProtocol.Tests.Protocol;
|
@@ -51,4 +52,41 @@ public static void ToolInputSchema_AcceptsValidSchemaDocuments(string validSchem
|
51 | 52 |
|
52 | 53 | Assert.True(JsonElement.DeepEquals(document.RootElement, tool.InputSchema));
|
53 | 54 | }
|
| 55 | + |
| 56 | + [Theory] |
| 57 | + [InlineData(Role.User, "\"user\"")] |
| 58 | + [InlineData(Role.Assistant, "\"assistant\"")] |
| 59 | + public static void SerializeRole_ShouldBeCamelCased(Role role, string expectedValue) |
| 60 | + { |
| 61 | + var actualValue = JsonSerializer.Serialize(role); |
| 62 | + |
| 63 | + Assert.Equal(expectedValue, actualValue); |
| 64 | + } |
| 65 | + |
| 66 | + [Theory] |
| 67 | + [InlineData(LoggingLevel.Debug, "\"debug\"")] |
| 68 | + [InlineData(LoggingLevel.Info, "\"info\"")] |
| 69 | + [InlineData(LoggingLevel.Notice, "\"notice\"")] |
| 70 | + [InlineData(LoggingLevel.Warning, "\"warning\"")] |
| 71 | + [InlineData(LoggingLevel.Error, "\"error\"")] |
| 72 | + [InlineData(LoggingLevel.Critical, "\"critical\"")] |
| 73 | + [InlineData(LoggingLevel.Alert, "\"alert\"")] |
| 74 | + [InlineData(LoggingLevel.Emergency, "\"emergency\"")] |
| 75 | + public static void SerializeLoggingLevel_ShouldBeCamelCased(LoggingLevel level, string expectedValue) |
| 76 | + { |
| 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); |
| 89 | + |
| 90 | + Assert.Equal(expectedValue, actualValue); |
| 91 | + } |
54 | 92 | }
|
0 commit comments