public void AddFirstPlayer()
        {
            var game           = GetGame();
            var gameRepository = new InMemoryGameRepository(game);
            var gameServices   = new GameServices(gameRepository, null, null);

            gameServices.AddPlayer(game.Id, "player1");

            Check.That(game.Players.Select(x => x.Name)).ContainsExactly("player1");
            Check.That(game.CurrentPlayer.Name).IsEqualTo("player1");
        }
        public void AddAnotherPlayerWithoutChangingCurrentPlayer()
        {
            var player1        = new Player("player1");
            var game           = GetGame(player1);
            var gameRepository = new InMemoryGameRepository(game);
            var gameServices   = new GameServices(gameRepository, null, null);

            gameServices.AddPlayer(game.Id, "player2");

            Check.That(game.Players.Select(x => x.Name)).ContainsExactly("player1", "player2");
            Check.That(game.CurrentPlayer).IsEqualTo(player1);
        }
示例#3
0
 public void AddPlayer(string gameId, string playerName)
 {
     gameServices.AddPlayer(gameId, playerName);
 }