Files
h-school/tests/HSchool.Server.Tests/PersonCardReaderShapeTests.cs
T
Leonid PershinandCursor 34f28f9ab8 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>
2026-08-20 17:37:55 +03:00

30 lines
994 B
C#

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);
}
}