Skip to content

Commit

Permalink
Fix players in lobby default list
Browse files Browse the repository at this point in the history
  • Loading branch information
QuinnBast committed Sep 3, 2023
1 parent 1d5bebd commit 8d5ed87
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Core/Models/Network/GameLobbyModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class GameConfiguration
public DateTime TimeCreated { get; set; } = DateTime.UtcNow;
public DateTime TimeStarted { get; set; } = DateTime.UtcNow;
public DateTime ExpiresAt { get; set; } = DateTime.MaxValue;
public List<User> PlayersInLobby { get; set; } = new List<User>() { new SimpleUser() { Id = "1", Username = "Test1"}.ToUser(), new SimpleUser(){ Id = "2", Username = "Test2"}.ToUser() };
public List<User> PlayersInLobby { get; set; } = new List<User>() { };

public Dictionary<string, List<SpecialistTypeId>> PlayerSpecialistDecks { get; set; } =
new Dictionary<string, List<SpecialistTypeId>>();
Expand Down
5 changes: 5 additions & 0 deletions Core/SubterfugeCore/Core/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public static Game Bare()
private Game()
{
GameConfiguration = new GameConfiguration();
GameConfiguration.PlayersInLobby = new List<User>()
{
new SimpleUser() { Id = "1", Username = "Test1" }.ToUser(),
new SimpleUser() { Id = "2", Username = "Test1" }.ToUser(),
};
SetupGameFromConfiguration(GameConfiguration, false);
}

Expand Down
2 changes: 2 additions & 0 deletions Core/SubterfugeCoreTest/GameTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public void CanAddOutpostsToBareGame()
public void GameCanLoadFromConfiguration()
{
GameConfiguration config = new GameConfiguration();
config.PlayersInLobby = new List<User>() { new SimpleUser() { Id = "1", Username = "Test" }.ToUser() };
Game game = Game.FromGameConfiguration(config);
Assert.AreEqual(game.TimeMachine.GetState().GetPlayers().Count, config.PlayersInLobby.Count);
}
Expand All @@ -46,6 +47,7 @@ public void GameCanLoadFromConfiguration()
public void GameCreatedFromConfigGeneratesMap()
{
GameConfiguration config = new GameConfiguration();
config.PlayersInLobby = new List<User>() { new SimpleUser() { Id = "1", Username = "Test" }.ToUser() };
Game game = Game.FromGameConfiguration(config);
Assert.AreEqual(game.TimeMachine.GetState().GetPlayers().Count, config.PlayersInLobby.Count);
Assert.IsTrue(game.TimeMachine.GetState().GetOutposts().Count > 0);
Expand Down

0 comments on commit 8d5ed87

Please sign in to comment.