Thing/tests/GameCult.Thing.Contract.Tests/InputKindNameTests.cs
Meta Vens ee80246cd0 GameCult.Thing.Contract: nil refused in every required slot, lists read-only, slot 2 is InputKind
ThingDomain.Present and Items; every constructor, factory and key builder passes each non-nullable
reference parameter through Present (refusal names the slot, never a value) and each list through
Items (a private read-only copy, nil items refused). Lists are IReadOnlyList on every type.
TextInputNode's slot 2 property and parameter are InputKind, matching Rust input_kind.
Tests: NilPositionTests reads the Rust vector row by row; PresenceTests and ReadOnlyListTests
walk every door by reflection; InputKindNameTests. NameSetTests and the unit-arm rewrite follow.
Unit-arm statics are still present in this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 02:18:45 +02:00

18 lines
859 B
C#

using System.Reflection;
using MessagePack;
namespace GameCult.Thing.Contract.Tests;
/// <summary>One name in every runtime: Rust input_kind, C# InputKind, TypeScript inputKind. The wire is the slot key, 2.</summary>
public sealed class InputKindNameTests
{
[Test]
public void TextInputNodeSlotTwoIsInputKindAndThereIsNoKind()
{
var properties = typeof(TextInputNode).GetProperties(BindingFlags.Public | BindingFlags.Instance);
var slotTwo = properties.Single(p => p.GetCustomAttribute<KeyAttribute>()?.IntKey == 2);
Assert.That((slotTwo.Name, slotTwo.PropertyType), Is.EqualTo(("InputKind", typeof(InputKind))));
Assert.That(properties.Select(p => p.Name), Does.Not.Contain("Kind"));
Assert.That(typeof(TextInputNode).GetConstructors().Single().GetParameters()[2].Name, Is.EqualTo("inputKind"));
}
}