Exemplo n.º 1
0
        public void Initialize_SetsRemainingPoints()
        {
            var player = new DartsPlayer(new Mock<IDartsThrower>().Object);
            player.Initialize(42);

            Assert.Equal(42, player.RemainingPoints);
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     dartsPlayer = FindObjectOfType <DartsPlayer>();
 }