public void FinishGame_OneGame_GameIsNotStarted()
        {
            int       maxWins = 3;
            Move      move1   = new Move("Rock");
            Move      move2   = new Move("Scissors");
            Move      move3   = new Move("Paper");
            GameRules rules   = new GameRules(maxWins);

            move1.AddKill(move2.Name);
            move2.AddKill(move3.Name);
            move3.AddKill(move1.Name);

            rules.AddMove(move1);
            rules.AddMove(move2);
            rules.AddMove(move3);

            string sessionId = GameSessionManager.StartGame(rules, "player1", "player2");

            //Act
            GameSessionManager.FinishGame(sessionId);

            //Assert
            Assert.AreEqual(false, GameSessionManager.IsGameStarted(sessionId));
            Assert.AreEqual(0, GameSessionManager.GetCurrentStartedCount());
        }
Exemple #2
0
        public GameData MakePlay(
            string sessionId,
            string player1MoveName,
            string player2MoveName)
        {
            Game game = GetStartedGame(sessionId);

            game.Play(player1MoveName, player2MoveName);

            if (game.HasWinner())
            {
                RegisterGameResult(game);

                GameSessionManager.FinishGame(sessionId);
            }

            return(game.Data);
        }
 public void FinishGame_GameNotStarted_ThrowGameNotStartedException()
 {
     //Act
     GameSessionManager.FinishGame("NotValidGameSession");
 }