public void ScoreShouldBeFifteenLoveTest()
        {
            TennisGame tennisGame = new TennisGame("James", "Edwards");

            tennisGame.PointScored("James");
            Assert.AreEqual("Fifteen-Love", tennisGame.Score());
        }
        public void ScoreShouldBeThiryFifteenTest()
        {
            TennisGame tennisGame = new TennisGame("James", "Edwards");

            tennisGame.PointScored("James");
            tennisGame.PointScored("James");
            tennisGame.PointScored("Edwards");
            Assert.AreEqual("Thirty-Fifteen", tennisGame.Score());
        }
Beispiel #3
0
        public void IncrementScoreCorrectly(int player1, int player2, bool player1Win, int player1Outcome, int player2Outcome)
        {
            // Set up original score
            var tennisPlayer1 = new TennisPlayerBuilder().WithScore(player1).Build();
            var tennisPlayer2 = new TennisPlayerBuilder().WithScore(player2).Build();

            var sut = new TennisGame(_player1.Object, _player2.Object);

            if (player1Win)
            {
                sut.Score(tennisPlayer1, tennisPlayer2);
            }
            else
            {
                sut.Score(tennisPlayer2, tennisPlayer1);
            }

            Assert.AreEqual(player1Outcome, tennisPlayer1.Score);
            Assert.AreEqual(player2Outcome, tennisPlayer2.Score);
        }
Beispiel #4
0
        public void IncrementScoreUnderCorrectConditions()
        {
            _player1.Setup(x => x.Score).Returns(0);
            _player2.Setup(x => x.Score).Returns(1);

            var sut = new TennisGame(_player1.Object, _player2.Object);

            sut.Score(_player1.Object, _player2.Object);

            _player1.Verify(mock => mock.IncrementScore(), Times.Once());
        }
Beispiel #5
0
        public void WinGameWhenScoreIsCorrect()
        {
            _player1.Setup(x => x.Score).Returns(0);
            _player2.Setup(x => x.Score).Returns(3);

            var sut = new TennisGame(_player2.Object, _player1.Object);

            sut.Score(_player2.Object, _player1.Object);

            _player2.Verify(mock => mock.SetScoreToGame(), Times.Once);
        }
        public void ScoreShouldbePlayer1WonTest()
        {
            TennisGame tennisGame = new TennisGame("James", "Edwards");

            tennisGame.PointScored("James");
            tennisGame.PointScored("James");
            tennisGame.PointScored("James");
            tennisGame.PointScored("James");
            tennisGame.PointScored("James");
            tennisGame.PointScored("Edwards");


            Assert.AreEqual("James - Won", tennisGame.Score());
        }
Beispiel #7
0
        public void LoveAll()
        {
            // arrange
            const string expected = "Love All";
            var          sut      = new TennisGame();

            // act
            sut.HomeScore = 0;
            sut.AwayScore = 0;
            var actual = sut.Score();

            // assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #8
0
        public void Deuce_When_3_3()
        {
            // arrange
            const string expected = "Deuce";
            var          sut      = new TennisGame();

            // act
            sut.HomeScore = 3;
            sut.AwayScore = 3;
            var actual = sut.Score();

            // assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #9
0
        public void FortyFifteen()
        {
            // arrange
            const string expected = "Forty Fifteen";
            var          sut      = new TennisGame();

            // act
            sut.HomeScore = 3;
            sut.AwayScore = 1;
            var actual = sut.Score();

            // assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #10
0
        public void Home_Win_4_0()
        {
            // arrange
            const string expected = "John Win";
            var          sut      = new TennisGame();

            // act
            sut.HomeScore = 4;
            sut.AwayScore = 0;
            var actual = sut.Score();

            // assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #11
0
        public void Away_Advantage()
        {
            // arrange
            const string expected = "Tom Adv";
            var          sut      = new TennisGame();

            // act
            sut.HomeScore = 3;
            sut.AwayScore = 4;
            var actual = sut.Score();

            // assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #12
0
        public void ScoreShouldBeAdvantagePlayer2Test()
        {
            TennisGame tennisGame = new TennisGame("James", "Edwards");

            tennisGame.PointScored("James");
            tennisGame.PointScored("James");
            tennisGame.PointScored("James");
            tennisGame.PointScored("James");
            tennisGame.PointScored("Edwards");
            tennisGame.PointScored("Edwards");
            tennisGame.PointScored("Edwards");
            tennisGame.PointScored("Edwards");
            tennisGame.PointScored("Edwards");

            Assert.AreEqual("Advantage - Edwards", tennisGame.Score());
        }
Beispiel #13
0
        public void ScoreShouldBeLoveAllTest()
        {
            TennisGame tennisGame = new TennisGame("James", "Edwards");

            Assert.AreEqual("Love-All", tennisGame.Score());
        }
 private void ScoreShouldBe(string expected)
 {
     Assert.AreEqual(expected, _tennisGame.Score());
 }
Beispiel #15
0
 public void WhenGameStartsTheScoreIsLoveAll()
 {
     Assert.AreEqual("Love all", tennisGame.Score());
 }