コード例 #1
0
        public void GivenANewGameAndTwoPlayers_WhenStartingAndPlayer1PlaysANumberEqualToPlayer1_ThenNullShouldBeReturned_()
        {
            //GivenANewGameAndTwoPlayers
            WinnerPlayer p1 = new WinnerPlayer();
            WinnerPlayer p2 = new WinnerPlayer();

            Game g = new Game(p1, p2);

            //WhenStartingAndPlayer1PlaysANumberGreaterThanPlayer2
            IPlayer winner = g.Start();

            //ThenPlayer1ShouldBeReturned
            Assert.IsNull(winner);
        }
コード例 #2
0
        public void GivenANewGameAndTwoPlayers_WhenStartingAndPlayer1PlaysANumberGreaterThanPlayer2_ThenPlayer1ShouldBeReturned_()
        {
            //GivenANewGameAndTwoPlayers
            WinnerPlayer p1 = new WinnerPlayer();
            LoserPlayer  p2 = new LoserPlayer();

            Game g = new Game(p1, p2);

            //WhenStartingAndPlayer1PlaysANumberGreaterThanPlayer2
            IPlayer winner = g.Start();

            //ThenPlayer1ShouldBeReturned
            Assert.AreEqual(g.Player1, winner);
        }