using ZB.MOM.WW.MxGateway.Worker.Conversion; using ZB.MOM.WW.MxGateway.Worker.MxAccess; namespace ZB.MOM.WW.MxGateway.Worker.Tests.TestSupport; /// /// Shared no-operation for tests that need to /// construct an via /// but do not exercise any /// MXAccess COM call. Replaces the per-file NullMxAccessServer copy /// that previously lived inside AlarmCommandExecutorTests and was /// constructed via reflection — see Worker.Tests-016 for the rationale. /// internal sealed class NoopMxAccessServer : IMxAccessServer { /// public int Register(string clientName) => 0; /// public void Unregister(int serverHandle) { } /// public int AddItem(int serverHandle, string itemDefinition) => 0; /// public int AddItem2(int serverHandle, string itemDefinition, string itemContext) => 0; /// public void RemoveItem(int serverHandle, int itemHandle) { } /// public void Advise(int serverHandle, int itemHandle) { } /// public void UnAdvise(int serverHandle, int itemHandle) { } /// public void AdviseSupervisory(int serverHandle, int itemHandle) { } /// public int AddBufferedItem(int serverHandle, string itemDefinition, string itemContext) => 0; /// public void SetBufferedUpdateInterval(int serverHandle, int updateIntervalMilliseconds) { } /// public object Suspend(int serverHandle, int itemHandle) => new FakeMxStatus(); /// public object Activate(int serverHandle, int itemHandle) => new FakeMxStatus(); /// public void Write(int serverHandle, int itemHandle, object? value, int userId) { } /// public void Write2(int serverHandle, int itemHandle, object? value, object? timestampValue, int userId) { } /// public void WriteSecured(int serverHandle, int itemHandle, int currentUserId, int verifierUserId, object? value) { } /// public void WriteSecured2(int serverHandle, int itemHandle, int currentUserId, int verifierUserId, object? value, object? timestampValue) { } /// public int AuthenticateUser(int serverHandle, string verifyUser, string verifyUserPassword) => 0; /// public int ArchestrAUserToId(int serverHandle, string userIdGuid) => 0; } /// /// Minimal stand-in for the native ArchestrA.MxAccess.MxStatus struct. /// reflects over the public /// success, category, detectedBy, and detail /// fields, so this fake exposes the same field shape with all-OK values. /// internal sealed class FakeMxStatus { // These public fields exist solely so MxStatusProxyConverter can reflect // over them by name; they are read through reflection, not directly, so the // compiler's "never assigned" (CS0649) diagnostic does not apply. #pragma warning disable CS0649 /// Success indicator field read by the status converter. public int success; /// Status category field read by the status converter. public int category; /// Status detected-by field read by the status converter. public int detectedBy; /// Status detail field read by the status converter. public int detail; #pragma warning restore CS0649 }