コード例 #1
0
        public void MaximumCloseCombatWeaponsReached()
        {
            var warrior = new WitchHunterCaptain();

            ICloseCombatWeapon singleHandenWeapon = new Dagger();
            ICloseCombatWeapon twoHandWeapon      = new WeepingBlades();

            Assert.IsFalse(warrior.MaximumCloseCombatWeaponsReached());
            warrior.AddEquipment(singleHandenWeapon);
            Assert.IsFalse(warrior.MaximumCloseCombatWeaponsReached());

            warrior.AddEquipment(singleHandenWeapon);
            warrior.AddEquipment(singleHandenWeapon);

            Assert.IsTrue(warrior.MaximumCloseCombatWeaponsReached());

            warrior.RemoveEquipment(singleHandenWeapon);
            warrior.RemoveEquipment(singleHandenWeapon);
            warrior.RemoveEquipment(singleHandenWeapon);

            Assert.AreEqual(0, warrior.Equipment.Count);

            warrior.AddEquipment(singleHandenWeapon);
            warrior.AddEquipment(twoHandWeapon);

            Assert.IsTrue(warrior.MaximumCloseCombatWeaponsReached());

            warrior.RemoveEquipment(singleHandenWeapon);
            Assert.IsTrue(warrior.MaximumCloseCombatWeaponsReached(), "Weeping blades is a pair");
        }
コード例 #2
0
        public void HasTwoIdenticalCloseCombatWeapons()
        {
            var warrior = new WitchHunterCaptain();
            var dagger  = new Dagger();

            Assert.IsFalse(warrior.Equipment.HasTwoIdenticalCloseCombatWeapons());
            warrior.AddEquipment(new Sword());
            Assert.IsFalse(warrior.Equipment.HasTwoIdenticalCloseCombatWeapons());

            warrior.AddEquipment(dagger);
            Assert.IsFalse(warrior.Equipment.HasTwoIdenticalCloseCombatWeapons());

            warrior.RemoveEquipment(dagger);
            warrior.AddEquipment(new Sword());
            Assert.IsTrue(warrior.Equipment.HasTwoIdenticalCloseCombatWeapons());
        }