예제 #1
0
        public void Hit_Test(int diceRoll, bool result)
        {
            // Arrange
            IDice dice = A.Fake <IDice>();

            A.CallTo(() => dice.Roll()).Returns(diceRoll);

            WbsEngine engine = new WbsEngine(dice);

            Unit guardsman   = UnitFactory.Createguardsman();
            Unit fireWarrior = UnitFactory.Createfirewarrior();

            // Act
            bool hit = engine.Hit(guardsman, fireWarrior);

            // Assert
            Assert.AreEqual(hit, result);
        }
예제 #2
0
파일: WbSEngineTest.cs 프로젝트: c-true/wbs
        public void Hit_False()
        {
            // Arrange
            IDice dice = A.Fake <IDice>();

            A.CallTo(() => dice.Roll()).Returns(1);

            WbsEngine engine = new WbsEngine(dice);

            Unit guardsman = new Unit();

            guardsman.Name           = "Guardsman";
            guardsman.Movement       = 6;
            guardsman.WeaponSkill    = 4;
            guardsman.BallisticSkill = 4;
            guardsman.Strength       = 3;
            guardsman.Toughness      = 3;
            guardsman.Wounds         = 1;
            guardsman.Attack         = 1;
            guardsman.Leadership     = 6;
            guardsman.Save           = 5;

            Unit fireWarrior = new Unit();

            fireWarrior.Name           = "Fire Warrior";
            fireWarrior.Movement       = 6;
            fireWarrior.WeaponSkill    = 5;
            fireWarrior.BallisticSkill = 4;
            fireWarrior.Strength       = 3;
            fireWarrior.Toughness      = 3;
            fireWarrior.Wounds         = 1;
            fireWarrior.Attack         = 1;
            fireWarrior.Leadership     = 6;
            fireWarrior.Save           = 4;

            // Act
            bool hit = engine.Hit(guardsman, fireWarrior);

            // Assert
            Assert.IsFalse(hit);
        }