diff --git a/src/MxGateway.Worker.Tests/ProjectStructure/WorkerProjectReferenceTests.cs b/src/MxGateway.Worker.Tests/ProjectStructure/WorkerProjectReferenceTests.cs index fb0dc1a..1e9910f 100644 --- a/src/MxGateway.Worker.Tests/ProjectStructure/WorkerProjectReferenceTests.cs +++ b/src/MxGateway.Worker.Tests/ProjectStructure/WorkerProjectReferenceTests.cs @@ -29,9 +29,16 @@ public sealed class WorkerProjectReferenceTests Assert.Equal("x86", ElementValue(project, "PlatformTarget")); } - /// Verifies that MXAccess interop reference exists only in the worker project. + /// + /// 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 gateway.md); the worker test project + /// legitimately references the interop so it can exercise the + /// COM-facing worker code (e.g. WnWrapAlarmConsumer). + /// [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 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)