Пример #1
0
        public void GivenASoldier_WhenTwoSoldiersWithEqualWeaponDamageFight_TheAttackerWins()
        {
            Soldier attacker    = new Soldier("Attacker", 0);
            Soldier attackedOne = new Soldier("Attacked one", 0);

            Soldier winner = attacker.Fight(attackedOne);

            winner.Should().Be(attacker);
        }
Пример #2
0
        public void Soldier_whenAttacksAnotherSoldier_ShouldWin()
        {
            var john  = new Soldier("john");
            var smith = new Soldier("smith");

            john.Weapon.Type  = Weapon.EWeaponType.Axe;
            smith.Weapon.Type = Weapon.EWeaponType.BareFist;

            var result = john.Fight(smith, A.Fake <IAttacker>());

            result.Should().Be(john);
        }
Пример #3
0
        public void Soldier_whenCombatantsMatchedAttackerWins()
        {
            var john  = new Soldier("john");
            var smith = new Soldier("smith");

            john.Weapon.Type  = Weapon.EWeaponType.BareFist;
            smith.Weapon.Type = Weapon.EWeaponType.BareFist;

            var attacker = A.Fake <IAttacker>();

            A.CallTo(() => attacker.GetAttacker(john, smith)).Returns(john);

            var result = john.Fight(smith, attacker);

            result.Should().Be(john);
        }