Example #1
0
        public void Love_Thirty()
        {
            var gameId = 1;

            IRepository <Game> repo = Substitute.For <IRepository <Game> >();

            repo.GetGame(gameId).Returns(new Game {
                Id = gameId, FirstPlayerScore = 0, SecondPlayerScore = 2
            });

            TennisGame tennisGame = new TennisGame(repo);

            var scoreResult = tennisGame.ScoreResult(gameId);

            Assert.AreEqual("Love Thirty", scoreResult);
        }
Example #2
0
        public void Deuce_when4to4()
        {
            var gameId = 1;

            IRepository <Game> repo = Substitute.For <IRepository <Game> >();

            repo.GetGame(gameId).Returns(new Game {
                Id = gameId, FirstPlayerScore = 4, SecondPlayerScore = 4
            });

            TennisGame tennisGame = new TennisGame(repo);

            var scoreResult = tennisGame.ScoreResult(gameId);

            Assert.AreEqual("Deuce", scoreResult);
        }
Example #3
0
        public void Joey_win()
        {
            var gameId = 1;

            IRepository <Game> repo = Substitute.For <IRepository <Game> >();

            repo.GetGame(gameId).Returns(new Game {
                Id = gameId, FirstPlayerScore = 5, SecondPlayerScore = 3
            });

            TennisGame tennisGame = new TennisGame(repo);

            var scoreResult = tennisGame.ScoreResult(gameId);

            Assert.AreEqual("Joey Win", scoreResult);
        }
Example #4
0
        public void Fifteen_All()
        {
            var gameId = 1;

            IRepository <Game> repo = Substitute.For <IRepository <Game> >();

            repo.GetGame(gameId).Returns(new Game {
                Id = gameId, FirstPlayerScore = 1, SecondPlayerScore = 1
            });

            TennisGame tennisGame = new TennisGame(repo);

            var scoreResult = tennisGame.ScoreResult(gameId);

            Assert.AreEqual("Fifteen All", scoreResult);
        }