Add serialization roundtrip tests for all Protocol namespace types (#1289)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
392e47ea29
commit
4cef394ad5
1 changed files with 3222 additions and 475 deletions
24
tests/ModelContextProtocol.Tests/Protocol/ArgumentTests.cs
Normal file
24
tests/ModelContextProtocol.Tests/Protocol/ArgumentTests.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using ModelContextProtocol.Protocol;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ModelContextProtocol.Tests.Protocol;
|
||||
|
||||
public static class ArgumentTests
|
||||
{
|
||||
[Fact]
|
||||
public static void Argument_SerializationRoundTrip_PreservesAllProperties()
|
||||
{
|
||||
var original = new Argument
|
||||
{
|
||||
Name = "temperature",
|
||||
Value = "72"
|
||||
};
|
||||
|
||||
string json = JsonSerializer.Serialize(original, McpJsonUtilities.DefaultOptions);
|
||||
var deserialized = JsonSerializer.Deserialize<Argument>(json, McpJsonUtilities.DefaultOptions);
|
||||
|
||||
Assert.NotNull(deserialized);
|
||||
Assert.Equal(original.Name, deserialized.Name);
|
||||
Assert.Equal(original.Value, deserialized.Value);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue