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:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user