Reorganize SDK source layout

This commit is contained in:
2026-08-18 00:13:44 +10:00
parent 44bb892ddd
commit 7dbecd4843
64 changed files with 4062 additions and 3740 deletions
@@ -1,3 +1,5 @@
using System;
using System.Linq;
using System.Text.Json;
using BinaryLane.Api.V2.Http;
using BinaryLane.Api.V2.Models;
@@ -146,4 +148,27 @@ public sealed class ModelSerializationTests
Assert.NotNull(future.AdditionalProperties);
Assert.Equal("kept", future.AdditionalProperties!["provider_option"].GetString());
}
[Fact]
public void EveryConcreteServerActionRoundTripsThroughItsProviderDiscriminator()
{
var actionTypes = typeof(ServerAction).Assembly
.GetTypes()
.Where(type =>
type.IsSealed &&
type.IsSubclassOf(typeof(ServerAction)) &&
type.GetConstructor(Type.EmptyTypes) is not null)
.OrderBy(type => type.Name, StringComparer.Ordinal);
foreach (var actionType in actionTypes)
{
var action = (ServerAction)Activator.CreateInstance(actionType)!;
string json = JsonSerializer.Serialize<ServerAction>(action, Json);
ServerAction? deserialized = JsonSerializer.Deserialize<ServerAction>(json, Json);
Assert.NotNull(deserialized);
Assert.Equal(actionType, deserialized.GetType());
Assert.Equal(action.Type, deserialized.Type);
}
}
}