public void SetupTests()
        {
            using (var repository = new TelephoneGameRepository())
            {
                _player1 = GameService.FindPlayer("15022967010", repository);
                _newGame = GameService.CreateNewGame<TwoPlayersOriginal>(_player1, repository);
                Assert.That(null != _newGame, "Game not created");

                _player2 = GameService.FindPlayer("15022967466", repository);
                GameService.AddPlayerToGame(_player2, _newGame, repository);
            }
        }
        public void SetupTests()
        {
            using (var repository = new TelephoneGameRepository())
            {
                _player1 = GameService.FindPlayer("15022967010", repository);
                _newGame = GameService.CreateNewGame<TwoPlayersOriginal>(_player1, repository);
                Assert.That(null != _newGame, "Game not created");

                EdgeConditional edge = _newGame.Edges.First<EdgeConditional>(e => e.nextNode.GetType().Name.Equals("PickPlayer"));

                Assert.That(GameService.TransitionGameState(_newGame, edge, repository), "Transition failed");

                _player2 = GameService.FindPlayer("15022967466", repository);
                GameService.AddPlayerToGame(_player2, _newGame, repository);

            }
        }
        public void SetupTests()
        {
            using (var repository = new TelephoneGameRepository())
            {
                bool success;

                _player1 = GameService.FindPlayer("15022967010", repository);
                _newGame = GameService.CreateNewGame<TwoPlayersOriginal>(_player1, repository);
                Assert.That(null != _newGame, "Game not created");

                success = GameService.TransitionGameState(_newGame, _newGame.Edges[0], repository);
                Assert.That(success, string.Format("Couldn't transition to {0}", _newGame.Edges[0].nextNode.routeName));

                _player2 = GameService.FindPlayer("15022967466", repository);
                GameService.AddPlayerToGame(_player2, _newGame, repository);
                Assert.That(_newGame.enoughPlayers, "not enough players added");

                success = GameService.TransitionGameState(_newGame, _newGame.Edges[0], repository);
                Assert.That(success, string.Format("Couldn't transition to {0}", _newGame.Edges[0].nextNode.routeName));
            }
        }
Beispiel #4
0
        internal void AddPlayer(Player player, TelephoneGameRepository repository)
        {
            if (_players.Count >= gameType.maxNumberOfPlayers)
            {
                throw new Exception(string.Format("Cannot add more than the maximum number of players for this game type: {0}", gameType.maxNumberOfPlayers));
            }

            if (null != _players.Values.FirstOrDefault<Player>(p => p.ID == player.ID))
            {
                throw new Exception("Player is already added to this game!");
            }

            _players[_nextPlayerNumber++] = player;
        }
        public void SetupTests()
        {
            using (var repository = new TelephoneGameRepository())
            {
                _player1 = GameService.FindPlayer("15022967010", repository);
                _player2 = GameService.FindPlayer("15022967466", repository);

                _game1 = GameService.CreateNewGame<TestingGameType>(_player1, repository);
                _game2 = GameService.CreateNewGame<TestingGameType>(_player1, repository);
                _game3 = GameService.CreateNewGame<TestingGameType>(_player1, repository);
                _game4 = GameService.CreateNewGame<TestingGameType>(_player1, repository);
                _game5 = GameService.CreateNewGame<TestingGameType>(_player1, repository);
                _game6 = GameService.CreateNewGame<TestingGameType>(_player1, repository);

                Assert.That(null != _game1, "Game1 not created");
                Assert.That(null != _game2, "Game2 not created");
                Assert.That(null != _game3, "Game3 not created");
                Assert.That(null != _game4, "Game4 not created");
                Assert.That(null != _game5, "Game4 not created");
                Assert.That(null != _game6, "Game4 not created");
            }
        }