mirror of
https://github.com/davidkaya/aryx.git
synced 2026-07-29 07:58:47 +02:00
feat: migrate packaging and auto updates
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization.Metadata;
|
||||
using Aryx.AgentHost.Services;
|
||||
|
||||
namespace Aryx.AgentHost.Tests;
|
||||
|
||||
public sealed class JsonSerializationTests
|
||||
{
|
||||
[Fact]
|
||||
public void CreateWebOptions_UsesDefaultJsonTypeInfoResolver()
|
||||
{
|
||||
JsonSerializerOptions options = JsonSerialization.CreateWebOptions();
|
||||
|
||||
Assert.IsType<DefaultJsonTypeInfoResolver>(options.TypeInfoResolver);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateWebOptions_RoundTripsRuntimeTypedPayloads()
|
||||
{
|
||||
JsonSerializerOptions options = JsonSerialization.CreateWebOptions();
|
||||
object payload = new TestPayload
|
||||
{
|
||||
Type = "describe-capabilities",
|
||||
RequestId = "req-1",
|
||||
};
|
||||
|
||||
string json = JsonSerializer.Serialize(payload, payload.GetType(), options);
|
||||
TestPayload? deserialized = JsonSerializer.Deserialize<TestPayload>(json, options);
|
||||
|
||||
Assert.NotNull(deserialized);
|
||||
Assert.Equal("describe-capabilities", deserialized.Type);
|
||||
Assert.Equal("req-1", deserialized.RequestId);
|
||||
}
|
||||
|
||||
private sealed class TestPayload
|
||||
{
|
||||
public string? Type { get; init; }
|
||||
|
||||
public string? RequestId { get; init; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user