Initial commit: Theriapolis baseline at port/godot branch point
Captures the pre-Godot-port state of the codebase. This is the rollback anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md). All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using System.Reflection;
|
||||
using Xunit;
|
||||
|
||||
namespace Theriapolis.Tests.Architecture;
|
||||
|
||||
/// <summary>
|
||||
/// Hard rule #1: Theriapolis.Core must not reference MonoGame or Microsoft.Xna.
|
||||
/// This test reflects over Core.dll and fails the build if any forbidden assembly
|
||||
/// is referenced.
|
||||
/// </summary>
|
||||
public sealed class CoreNoDependencyTests
|
||||
{
|
||||
private static readonly string[] ForbiddenPrefixes =
|
||||
{
|
||||
"Microsoft.Xna",
|
||||
"MonoGame",
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Core_DoesNotReference_MonoGame()
|
||||
{
|
||||
var coreAssembly = typeof(Theriapolis.Core.C).Assembly;
|
||||
var referenced = coreAssembly.GetReferencedAssemblies();
|
||||
|
||||
var violations = referenced
|
||||
.Where(r => ForbiddenPrefixes.Any(p => r.Name?.StartsWith(p, StringComparison.OrdinalIgnoreCase) == true))
|
||||
.Select(r => r.Name!)
|
||||
.ToList();
|
||||
|
||||
Assert.True(violations.Count == 0,
|
||||
$"Theriapolis.Core must not reference MonoGame/XNA. Violations: {string.Join(", ", violations)}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Phase 4 also requires the new Core namespaces (Tactical, Entities,
|
||||
/// Persistence, Time) to be MonoGame-free. The reflection check above
|
||||
/// already proves this at the assembly level — this test is a belt-and-
|
||||
/// braces audit that the namespaces actually exist (i.e., we didn't
|
||||
/// accidentally put them in Game).
|
||||
/// </summary>
|
||||
[Theory]
|
||||
[InlineData("Theriapolis.Core.Tactical")]
|
||||
[InlineData("Theriapolis.Core.Entities")]
|
||||
[InlineData("Theriapolis.Core.Persistence")]
|
||||
[InlineData("Theriapolis.Core.Time")]
|
||||
public void CoreNamespace_ExistsAndIsMonoGameFree(string ns)
|
||||
{
|
||||
var asm = typeof(Theriapolis.Core.C).Assembly;
|
||||
var anyType = asm.GetTypes().FirstOrDefault(t => t.Namespace == ns);
|
||||
Assert.NotNull(anyType);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user