Use IHubContext for delayed slip completion
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
Avoid ObjectDisposedException when sending SignalR updates after the 30-second delay by accessing clients through IHubContext instead of the disposed hub instance. Signed-off-by: Tim Krampitz <Tim.Krampitz@live.com>
This commit is contained in:
@@ -24,6 +24,8 @@ public class GameHubTests
|
||||
private readonly Mock<ISingleClientProxy> _callerProxy = new();
|
||||
private readonly Mock<IClientProxy> _groupProxy = new();
|
||||
private readonly Mock<ISingleClientProxy> _clientProxy = new();
|
||||
private readonly Mock<IHubContext<GameHub>> _hubContext = new();
|
||||
private readonly Mock<IHubClients> _hubClients = new();
|
||||
private readonly GameHub _hub;
|
||||
|
||||
private const string ConnectionId = "test-connection-id";
|
||||
@@ -35,7 +37,11 @@ public class GameHubTests
|
||||
_clients.Setup(c => c.Group(It.IsAny<string>())).Returns(_groupProxy.Object);
|
||||
_clients.Setup(c => c.Client(It.IsAny<string>())).Returns(_clientProxy.Object);
|
||||
|
||||
_hub = new GameHub(_gameService.Object, _factory, NullLogger<GameHub>.Instance);
|
||||
_hubClients.Setup(c => c.Group(It.IsAny<string>())).Returns(_groupProxy.Object);
|
||||
_hubClients.Setup(c => c.Client(It.IsAny<string>())).Returns(_clientProxy.Object);
|
||||
_hubContext.Setup(c => c.Clients).Returns(_hubClients.Object);
|
||||
|
||||
_hub = new GameHub(_gameService.Object, _factory, NullLogger<GameHub>.Instance, _hubContext.Object);
|
||||
SetupContext();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user