public void LowRollShouldMiss()
        {
            IRollable d20 = new MockDie(7);
            Player badFighter = new Player(d20);
            Orc anOrc = new Orc();

            Assert.IsFalse(badFighter.Attack(anOrc));
        }
        public void HighRollShouldHit()
        {
            IRollable d20 = new MockDie(18);
            Player goodFighter = new Player(d20);
            Orc anOrc = new Orc();

            Assert.IsTrue(goodFighter.Attack(anOrc));
        }
        public void HasDied(Orc orc)
        {
            if (orc != orcExpectedToDie)
            {
                Assert.Fail("Unexpected orc died.");
            }

            deadOrc = orc;
        }
Exemple #4
0
 public Boolean Attack(Orc anOrc)
 {
     if (myD20.Roll() >= 13)
     {
         return(hit(anOrc));
     }
     else
     {
         return(miss());
     }
 }
        public void OrcShouldDie()
        {
            MockGame mockGame = new MockGame();
            Orc weakOrc = new Orc(mockGame, 10);
            mockGame.ExpectHasDied(weakOrc);

            MockDie d20 = new MockDie();
            d20.AddRoll(18);
            d20.AddRoll(10);

            Player fighter = new Player(d20);
            fighter.Attack(weakOrc);

            Assert.IsTrue(weakOrc.IsDead());
            mockGame.Verify();
        }
 private bool hit(Orc anOrc)
 {
     anOrc.Injure(myD20.Roll());
     return true;
 }
 public Boolean Attack(Orc anOrc)
 {
     if (myD20.Roll() >= 13)
     {
         return hit(anOrc);
     }
     else
     {
         return miss();
     }
 }
        public void OrcShouldNotDie()
        {
            MockGame mockGame = new MockGame();
            Orc strongOrc = new Orc(mockGame, 30);

            MockDie d20 = new MockDie();
            d20.AddRoll(18);
            d20.AddRoll(10);

            Player fighter = new Player(d20);
            fighter.Attack(strongOrc);

            Assert.IsFalse(strongOrc.IsDead());
            mockGame.Verify();
        }
 public void ExpectHasDied(Orc orc)
 {
     orcExpectedToDie = orc;
 }
Exemple #10
0
 private bool hit(Orc anOrc)
 {
     anOrc.Injure(myD20.Roll());
     return(true);
 }