Files
TeslaSuite/Console/tests/TeslaConsole.DiffTests/PublicApiSurfaceTests.cs
T
CydandClaude Opus 4.8 548550b312 Initial commit: TeslaSuite monorepo (TeslaConsole + TeslaLauncher)
Co-locate the two cockpit-pod projects into a single repository:

- Console/  : TeslaConsole, the net48 WinForms operator console (decompiled
              reconstruction) plus its differential + catalog test suite.
- Launcher/ : TeslaLauncher, the net6 pod-side Service + Agent rewrite.

Adds a combined TeslaSuite.sln, root README documenting the shared wire
contract (and its current duplication, the main follow-up), and a root
.gitignore. Histories were not preserved per request; this is a fresh start
from the current working state of both projects.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 14:43:28 -05:00

57 lines
2.5 KiB
C#

using System.Linq;
using Xunit;
namespace TeslaConsole.DiffTests
{
/// <summary>
/// Structural equivalence: every public type and public member exposed by the
/// original TeslaConsole.exe must also be exposed, with the same signature, by the
/// recovered build. This is a strong "same program" contract that catches any
/// dropped, renamed, or re-signatured member introduced during reconstruction.
///
/// The enumeration runs inside each assembly's own AppDomain (see DifferentialFixture)
/// because the two files share identical assembly identity and cannot coexist in one
/// domain. Compiler-generated members are excluded — the README notes those legitimately
/// differ between a decompilation and the lost original sources.
/// </summary>
public class PublicApiSurfaceTests : IClassFixture<DifferentialFixture>
{
private readonly DifferentialFixture _fx;
public PublicApiSurfaceTests(DifferentialFixture fx) => _fx = fx;
[Fact]
public void Recovered_Exposes_All_Original_Public_Types()
{
var original = _fx.Original.GetPublicTypeNames();
var recovered = _fx.Recovered.GetPublicTypeNames();
// Sanity: the original actually yielded a non-trivial surface to compare.
Assert.True(original.Length > 20,
"Only " + original.Length + " public types enumerated from the original; " +
"dependency resolution likely failed.");
var missing = original.Except(recovered).OrderBy(s => s).ToArray();
Assert.True(missing.Length == 0,
"Public types present in the original but missing from the recovered build:\n " +
string.Join("\n ", missing));
}
[Fact]
public void Recovered_Exposes_All_Original_Public_Members()
{
var original = _fx.Original.GetPublicMemberSignatures();
var recovered = _fx.Recovered.GetPublicMemberSignatures();
Assert.True(original.Length > 100,
"Only " + original.Length + " public members enumerated from the original; " +
"dependency resolution likely failed.");
var missing = original.Except(recovered).OrderBy(s => s).ToArray();
Assert.True(missing.Length == 0,
missing.Length + " public member(s) present in the original but missing from the recovered build:\n " +
string.Join("\n ", missing.Take(80)));
}
}
}