Fix stale WorkerProjectReferenceTests MXAccess-interop assertion

MxAccessInteropReference_ExistsOnlyInWorkerProject asserted the MXAccess COM
interop was referenced only by MxGateway.Worker. The worker test project now
legitimately references ArchestrA.MxAccess and Interop.WNWRAPCONSUMERLib so it
can exercise the COM-facing worker code (WnWrapAlarmConsumer, the alarm
tests). Renamed to ..._ExistsOnlyInWorkerAndWorkerTestProjects, updated the
assertion to expect both projects, and made it order-independent. The
architecture invariant the test protects — the gateway/contracts never
reference MXAccess COM — still holds.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-05-18 23:19:32 -04:00
parent bb5603b7ec
commit 964b40dcbc
@@ -29,9 +29,16 @@ public sealed class WorkerProjectReferenceTests
Assert.Equal("x86", ElementValue(project, "PlatformTarget"));
}
/// <summary>Verifies that MXAccess interop reference exists only in the worker project.</summary>
/// <summary>
/// Verifies that the MXAccess COM interop is referenced only by the
/// worker project and its test project — never by the gateway server
/// or the contracts project. The gateway must never load MXAccess COM
/// directly (see <c>gateway.md</c>); the worker test project
/// legitimately references the interop so it can exercise the
/// COM-facing worker code (e.g. <c>WnWrapAlarmConsumer</c>).
/// </summary>
[Fact]
public void MxAccessInteropReference_ExistsOnlyInWorkerProject()
public void MxAccessInteropReference_ExistsOnlyInWorkerAndWorkerTestProjects()
{
DirectoryInfo repositoryRoot = FindRepositoryRoot();
string[] projectFiles = Directory.GetFiles(repositoryRoot.FullName, "*.csproj", SearchOption.AllDirectories)
@@ -42,9 +49,12 @@ public sealed class WorkerProjectReferenceTests
IReadOnlyList<string> projectsWithMxAccessReference = projectFiles
.Where(ProjectReferencesMxAccess)
.Select(path => Path.GetFileNameWithoutExtension(path))
.OrderBy(name => name, StringComparer.Ordinal)
.ToArray();
Assert.Equal(["MxGateway.Worker"], projectsWithMxAccessReference);
Assert.Equal(
["MxGateway.Worker", "MxGateway.Worker.Tests"],
projectsWithMxAccessReference);
}
private static bool ProjectReferencesMxAccess(string projectPath)