using Microsoft.AspNetCore.SignalR; namespace ZB.MOM.WW.OtOpcUa.Admin.Tests; /// /// Minimal in-memory that captures SendAsync invocations for /// assertion. Only the methods the FleetStatusPoller actually calls are implemented — /// other interface surface throws to fail fast if the poller evolves new dependencies. /// public sealed class RecordingHubContext : IHubContext where THub : Hub { public RecordingHubContext(RecordingHubClients clients) => Clients = clients; public IHubClients Clients { get; } public IGroupManager Groups => throw new NotImplementedException(); } public sealed class RecordingHubClients : IHubClients { public readonly List SentMessages = []; public IClientProxy All => NotUsed(); public IClientProxy AllExcept(IReadOnlyList excludedConnectionIds) => NotUsed(); public IClientProxy Client(string connectionId) => NotUsed(); public IClientProxy Clients(IReadOnlyList connectionIds) => NotUsed(); public IClientProxy Group(string groupName) => new RecordingClientProxy(groupName, SentMessages); public IClientProxy GroupExcept(string groupName, IReadOnlyList excludedConnectionIds) => NotUsed(); public IClientProxy Groups(IReadOnlyList groupNames) => NotUsed(); public IClientProxy User(string userId) => NotUsed(); public IClientProxy Users(IReadOnlyList userIds) => NotUsed(); private static IClientProxy NotUsed() => throw new NotImplementedException("not used by FleetStatusPoller"); } public sealed class RecordingClientProxy(string target, List sink) : IClientProxy { public Task SendCoreAsync(string method, object?[] args, CancellationToken cancellationToken = default) { sink.Add(new RecordedMessage(target, method, args)); return Task.CompletedTask; } } public sealed record RecordedMessage(string Target, string Method, object?[] Args);