Lobby: include HostUserId in GameStateDto and let client derive host status; update tests
Some checks failed
Build / build (pull_request) Failing after 1m0s
Some checks failed
Build / build (pull_request) Failing after 1m0s
This commit is contained in:
@@ -108,6 +108,7 @@ public class GameHubTests
|
||||
{
|
||||
GameId = game.Id,
|
||||
LobbyCode = game.LobbyCode,
|
||||
HostUserId = game.HostId,
|
||||
Players = [new PlayerInfoDto { Username = user.Username }]
|
||||
});
|
||||
|
||||
@@ -151,7 +152,7 @@ public class GameHubTests
|
||||
|
||||
var game = new Game { Id = 3, LobbyCode = "JOIN42", HostId = 99 };
|
||||
_gameService.Setup(s => s.JoinGameAsync("JOIN42", user.Id, ConnectionId)).ReturnsAsync(game);
|
||||
_gameService.Setup(s => s.GetGameStateAsync(game.Id)).ReturnsAsync(new GameStateDto { GameId = 3 });
|
||||
_gameService.Setup(s => s.GetGameStateAsync(game.Id)).ReturnsAsync(new GameStateDto { GameId = 3, HostUserId = 99 });
|
||||
|
||||
await _hub.JoinLobby("JOIN42");
|
||||
|
||||
@@ -205,7 +206,7 @@ public class GameHubTests
|
||||
|
||||
_gameService.Setup(s => s.SetPlayerReadyAsync(game.Id, player.Id))
|
||||
.ReturnsAsync(new Game { Id = game.Id, LobbyCode = game.LobbyCode });
|
||||
_gameService.Setup(s => s.GetGameStateAsync(game.Id)).ReturnsAsync(new GameStateDto { GameId = game.Id });
|
||||
_gameService.Setup(s => s.GetGameStateAsync(game.Id)).ReturnsAsync(new GameStateDto { GameId = game.Id, HostUserId = game.HostId });
|
||||
|
||||
await _hub.PlayerReady(game.Id, player.Id);
|
||||
|
||||
@@ -540,7 +541,9 @@ public class GameHubTests
|
||||
SeedGameWithPlayers((user, ConnectionId));
|
||||
var gameId = db.Games.Single().Id;
|
||||
|
||||
_gameService.Setup(s => s.GetGameStateAsync(gameId)).ReturnsAsync(new GameStateDto { GameId = gameId });
|
||||
var hostId = db.Games.Single().HostId;
|
||||
|
||||
_gameService.Setup(s => s.GetGameStateAsync(gameId)).ReturnsAsync(new GameStateDto { GameId = gameId, HostUserId = hostId });
|
||||
|
||||
await _hub.RequestGameState(gameId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user