Lock PersonCardReader to a single public Read.

Phase 58 promised no second public card API; reflection now fails if another method appears.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 17:37:55 +03:00
co-authored by Cursor
parent f536b72bed
commit 34f28f9ab8
@@ -0,0 +1,29 @@
using System.Reflection;
using HSchool.Server.Game;
using HSchool.Simulation;
namespace HSchool.Server.Tests;
public class PersonCardReaderShapeTests
{
[Fact]
public void PersonCardReader_HasOnePublicRead()
{
var reader = typeof(PersonCardReader);
Assert.True(reader.IsAbstract && reader.IsSealed);
Assert.False(reader.IsPublic);
var publicMethods = reader.GetMethods(
BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly)
.Where(method => !method.IsSpecialName)
.ToArray();
var read = Assert.Single(publicMethods);
Assert.Equal("Read", read.Name);
var parameters = read.GetParameters();
Assert.Equal(3, parameters.Length);
Assert.Equal(typeof(School), parameters[0].ParameterType);
Assert.Equal(typeof(string), parameters[1].ParameterType);
Assert.Equal(typeof(string), parameters[2].ParameterType);
}
}