Пример #1
0
        public void LowRollShouldMiss()
        {
            IRollable d20 = new MockDie(7);
            Player badFighter = new Player(d20);
            Orc anOrc = new Orc();

            Assert.IsFalse(badFighter.Attack(anOrc));
        }
Пример #2
0
        public void HighRollShouldHit()
        {
            IRollable d20 = new MockDie(18);
            Player goodFighter = new Player(d20);
            Orc anOrc = new Orc();

            Assert.IsTrue(goodFighter.Attack(anOrc));
        }
Пример #3
0
        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();
        }
Пример #4
0
        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();
        }