|
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,30 @@ 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_Should_Be_Lower_Case(Role role, string expectedValue) |
| 60 | + { |
| 61 | + var actualValue = JsonSerializer.Serialize(role, McpJsonUtilities.DefaultOptions); |
| 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_Should_Be_Lower_Case(LoggingLevel level, string expectedValue) |
| 76 | + { |
| 77 | + var actualValue = JsonSerializer.Serialize(level, McpJsonUtilities.DefaultOptions); |
| 78 | + |
| 79 | + Assert.Equal(expectedValue, actualValue); |
| 80 | + } |
54 | 81 | }
|
0 commit comments