Example #1
0
        public void GetScore_GameInInitialState_GetsLoveForEveryone()
        {
            var game = TestGameFactory.CreateDefault();

            var score = game.GetGameScore();

            Assert.Equal(State.Normal, score.GameState);
            Assert.Equal(Score.Love, score.PlayerA);
            Assert.Equal(Score.Love, score.PlayerB);
        }
Example #2
0
        public void PromoteScore_GameInInlineDataState_FollowsScoreSequence(Score init, Score expected)
        {
            var game = TestGameFactory.Create(playerA: init);

            game.PromoteScore(Player.A);

            var score = game.GetGameScore();

            Assert.Equal(expected, score.PlayerA);
        }
Example #3
0
        public void GetScore_GameInInlineDataState_GetsInlineDatatState(Score playerA, Score playerB, State state)
        {
            var game = TestGameFactory.Create(playerA: playerA, playerB: playerB);

            var score = game.GetGameScore();

            Assert.Equal(state, score.GameState);
            Assert.Equal(playerA, score.PlayerA);
            Assert.Equal(playerB, score.PlayerB);
        }
Example #4
0
        public void PromoteScore_GameInInitialState_PromotesPlayerBScore()
        {
            var game = TestGameFactory.CreateDefault();

            game.PromoteScore(Player.B);

            var score = game.GetGameScore();

            Assert.Equal(Score.Love, score.PlayerA);
            Assert.Equal(Score.Fifteen, score.PlayerB);
        }
Example #5
0
        public void PromoteScore_GameInDeuceState_PromotesPlayerAndGameToAdvantageState()
        {
            var game = TestGameFactory.Create(playerA: Score.Forty, playerB: Score.Forty);

            game.PromoteScore(Player.A);

            var score = game.GetGameScore();

            Assert.Equal(State.Advantage, score.GameState);
            Assert.Equal(Score.FortyWithAdvantage, score.PlayerA);
            Assert.Equal(Score.Forty, score.PlayerB);
        }
Example #6
0
        public void PromoteScore_GameInThirtyFourtyState_PromotesGameToDeuceState()
        {
            var game = TestGameFactory.Create(playerA: Score.Thirty, playerB: Score.Forty);

            game.PromoteScore(Player.A);

            var score = game.GetGameScore();

            Assert.Equal(State.Deuce, score.GameState);
            Assert.Equal(Score.Forty, score.PlayerA);
            Assert.Equal(Score.Forty, score.PlayerB);
        }
Example #7
0
        public void PromoteScore_GameInWonState_ThrowsExceptionWhenPromote()
        {
            var game = TestGameFactory.Create(playerA: Score.Won, playerB: Score.Forty);

            Assert.Throws <InvalidOperationException>(() => game.PromoteScore(Player.A));
        }