예제 #1
0
        public void PlayTurn_ThrowsThreeDarts()
        {
            var dartThrower = new Mock<IDartsThrower>();
            var player = new DartsPlayer(dartThrower.Object);

            player.PlayTurn();

            dartThrower.Verify(d => d.ThrowDart(), Times.Exactly(3));
        }
예제 #2
0
        public void PlayTurn_WillNotDecreasePointsIfPointsGetsLessThatZero()
        {
            var dartThrower = new Mock<IDartsThrower>();
            dartThrower.SetupSequence(d => d.ThrowDart())
                .Returns(10)
                .Returns(20)
                .Returns(60);
            var player = new DartsPlayer(dartThrower.Object);
            player.Initialize(89);

            player.PlayTurn();

            Assert.Equal(89, player.RemainingPoints);
        }
예제 #3
0
        public void PlayTurn_DecreasesRemainingPointsUpToZero()
        {
            var dartThrower = new Mock<IDartsThrower>();
            dartThrower.SetupSequence(d => d.ThrowDart())
                .Returns(5)
                .Returns(10)
                .Returns(15);
            var player = new DartsPlayer(dartThrower.Object);
            player.Initialize(30);

            player.PlayTurn();

            Assert.Equal(0, player.RemainingPoints);
        }