Beispiel #1
0
        public void Serving_player_makes_a_point()
        {
            // Arrange
            var servingPlayer   = new Player("servingPlayer");
            var receivingPlayer = new Player("receivingPlayer");
            var game            = new TennisGame(servingPlayer, receivingPlayer);

            // Act
            game.Serve().Miss();

            // Assert
            Assert.Equal("Fifteen - Love", game.Score);
        }
Beispiel #2
0
        public void No_one_makes_a_point()
        {
            // Arrange
            var servingPlayer   = new Player("servingPlayer");
            var receivingPlayer = new Player("receivingPlayer");
            var game            = new TennisGame(servingPlayer, receivingPlayer);

            // Act
            game.Serve().Return();

            // Assert
            Assert.Equal("Love all", game.Score);
        }
Beispiel #3
0
        public void Scoring_happens_on_faulty_returns_or_double_servefaults()
        {
            // Arrange
            var servingPlayer   = new Player("servingPlayer");
            var receivingPlayer = new Player("receivingPlayer");
            var game            = new TennisGame(servingPlayer, receivingPlayer);


            // Act & assert 1st rally
            game.Serve().Return().Miss();
            Assert.Equal("Love - Fifteen", game.Score);

            // Act & assert 2nd rally
            game.Serve().Miss();
            Assert.Equal("Fifteen all", game.Score);

            // Act & assert 3rd rally
            game.ServeFaulty().ServeFaulty();
            Assert.Equal("Fifteen - Thirty", game.Score);

            // Act & assert fourth rally
            game.Serve().Return().Return().Miss();
            Assert.Equal("Thirty all", game.Score);
        }
 private static void PlayerOneScores(TennisGame game)
 {
     game.Serve().Miss();
 }
Beispiel #5
0
 private static void PlayerOneWinsRally(TennisGame game)
 {
     game.Serve().Miss();
 }
Beispiel #6
0
 private static I_am_serving PlayerTwoWinsRally(TennisGame game)
 {
     return(game.Serve().Return().Miss());
 }