public void Attack_EmptyCharcaterAttacks()
 {
     var human = new TestCharacters().InjuerdHuman;
     var emptyCharacter = new Character();
     Action attack = () => emptyCharacter.Attack(human);
     attack.ShouldThrow<NullReferenceException>();
 }
        public void Attack_SelfAttack()
        {
            var human = new TestCharacters().InjuerdHuman;

            Action attack = () => human.Attack(human);
            attack.ShouldThrow<InvalidOperationException>().WithMessage("Character can not Attack it self!");
        }
        public void Attack_NullAttack()
        {
            var human = new TestCharacters().InjuerdHuman;

            Action attack = () => human.Attack(null);
            attack.ShouldThrow<NullReferenceException>();
        }
        public void Apply_useHeathPoitionOnWrongCharacter()
        {
            var healthPotion = new TestItems().HealthPotion;
            var wolf = new TestCharacters().Wolf;

            Assert.Throws<WrongRequirementException>(()=> healthPotion.Apply(wolf));
        }
        public void Eqip_InvalidItem()
        {
            var human = new TestCharacters().InjuerdHuman;
            var amulet = new TestItems().ElvishAmulet;

           Assert.Throws<WrongRequirementException>(()=> human.Eqip(amulet));           
        }
        public void Defend_HumanDefends(int attackPoints, int expectedLifePoint)
        {
            var human = new TestCharacters().InjuerdHuman;

            human.Defend(attackPoints);
            human.CurrentFluentAttributes.LifePoints.Should().Be(expectedLifePoint);
        }
        public void Eqip_Amulet()
        {
            var elve = new TestCharacters().Elve;
            var amulet = new TestItems().ElvishAmulet;

            elve.Eqip(amulet);
            elve.Eqipped.Should().BeEquivalentTo(new List<StaticItem> { amulet });
        }
        public void Consume_AItemThatTheCharDoesnotHave()
        {
            var human = new TestCharacters().InjuerdHuman;
            var healthPotion = new TestItems().HealthPotion;

            var ex = Assert.Throws<InvalidOperationException>(() => human.Consume(healthPotion));
            ex.Message.Should().Be($"The Character ({human.Name}) has not this Item: {healthPotion.Name}");            
        }
        public void Apply_useHeathPoition()
        {
            var healthPotion = new TestItems().HealthPotion;
            var injuerdHuman = new TestCharacters().InjuerdHuman;
            healthPotion.Apply(injuerdHuman);

            injuerdHuman.CurrentFluentAttributes.LifePoints.Should().Be(11);
        }
        public void GetModifiedFluentAttributes_NothingEquipped()
        {
            var human = new TestCharacters().InjuerdHuman;

            var testData = human.GetModifiedFluentAttributes();

            testData.LifePoints.Should().Be(15);
        }
        public void Eqip_Sword()
        {
            var human = new TestCharacters().InjuerdHuman;
            var sword = new TestItems().Sword;

            human.Eqip(sword);
            human.Eqipped.Should().BeEquivalentTo(new List<StaticItem> { sword });
        }
        public void Eqip_ToMuch()
        {
            var human = new TestCharacters().InjuerdHuman;
            var sword = new TestItems().Sword;

            human.Eqip(sword);
            human.Eqip(sword);
            Assert.Throws<WrongRequirementException>(() => human.Eqip(sword));
        }
        public void Apply_useHeathPoitionOnHealthyCharcater()
        {
            var healthPotion = new TestItems().HealthPotion;
            var elve = new TestCharacters().Elve;

            healthPotion.Apply(elve);

            elve.CurrentFluentAttributes.LifePoints.Should().Be(13);
        }
        public void GetModifiedAttributes_NothingEquipped()
        {
            var human = new TestCharacters().InjuerdHuman;

            var testData = human.GetModifiedAttributes();

            testData.AttackPoints.Should().Be(5);
            testData.DefendPoints.Should().Be(5);
        }
        public void Attack_Human_Attacks_Elve()
        {
            var human = new TestCharacters().InjuerdHuman;
            var elve = new TestCharacters().Elve;

            human.Attack(elve);

            elve.CurrentFluentAttributes.LifePoints.Should().BeLessOrEqualTo(11)
                .And.BeGreaterOrEqualTo(6);
        }
        public void Consume_AExistingItem()
        {
            var human = new TestCharacters().InjuerdHuman;
            

            human.Consume(human.Inventory.Single() as ConsumableItem);

            human.Inventory.Should().BeEmpty();
            human.CurrentFluentAttributes.LifePoints.Should().Be(11);
        }
        public void GetModifiedFluentAttributes_AmuelettEquipped()
        {
            var human = new TestCharacters().InjuerdHuman;
            var amulett = new TestItems().AmuletOfLife;
            human.Eqip(amulett);

            var testData = human.GetModifiedFluentAttributes();

            testData.LifePoints.Should().Be(20);
        }
        public void Eqip_twice()
        {
            var elve = new TestCharacters().Elve;
            
            var sword = new TestItems().Sword;

            elve.Eqip(sword);
            elve.Eqip(sword);
            elve.Eqipped.Should().BeEquivalentTo(new List<StaticItem> { sword, sword});
        }
        public void Attack_EqiuppedElve_Attacks_Human()
        {
            var human = new TestCharacters().InjuerdHuman;
            var elve = new TestCharacters().Elve;
            var sword = new TestItems().Sword;
            elve.Eqip(sword);
            elve.Attack(human);

            human.CurrentFluentAttributes.LifePoints.Should().BeLessOrEqualTo(0)
                .And.BeGreaterOrEqualTo(-5);
        }
        public void GetModifiedAttributes_SwordEquipped()
        {
            var human = new TestCharacters().InjuerdHuman;
            var sword = new TestItems().Sword;
            human.Eqip(sword);

            var testData = human.GetModifiedAttributes();

            testData.AttackPoints.Should().Be(8);
            testData.DefendPoints.Should().Be(5);
        }
        public void Apply_useHeathPoitionOnEqipedCharcater()
        {
            var healthPotion = new TestItems().HealthPotion;
            var elve = new TestCharacters().Elve;
            var amuelet = new TestItems().ElvishAmulet;
            
            elve.Eqip(amuelet);

            healthPotion.Apply(elve);
            elve.CurrentFluentAttributes.LifePoints.Should().Be(18);
        }
        public void Eqip_Several()
        {
            var elve = new TestCharacters().Elve;
            var amulet = new TestItems().ElvishAmulet;
            var sword = new TestItems().Sword;
            var axe = new TestItems().Axe;

            elve.Eqip(sword);
            elve.Eqip(axe);
            elve.Eqip(amulet);
            elve.Eqipped.Should().BeEquivalentTo(new List<StaticItem> { amulet, sword, axe });
        }
        public void GetModifiedFluentAttributes_SeveralEquipped()
        {
            var human = new TestCharacters().InjuerdHuman;
            var amuletOfLife = new TestItems().AmuletOfLife;
            var amulettOfDead = new TestItems().AmuletOfDead;
            human.Eqip(amuletOfLife);
            human.Eqip(amulettOfDead);

            var testData = human.GetModifiedFluentAttributes();

            testData.LifePoints.Should().Be(13);
        }
        public void GetModifiedAttributes_SeveralEquipped()
        {
            var human = new TestCharacters().InjuerdHuman;
            var sword = new TestItems().Sword;
            var axe = new TestItems().Axe;
            human.Eqip(sword);
            human.Eqip(axe);

            var testData = human.GetModifiedAttributes();

            testData.AttackPoints.Should().Be(11);
            testData.DefendPoints.Should().Be(4);
        }
 public void Apply_useHeathPoitionDependsOnModifiedFluidAttributes()
 {
     var healthPotion = new TestItems().HealthPotion;
     var elve = Substitute.For<Character>();
     var baseElve = new TestCharacters().Elve;
     elve.BaseFluentAttributes = baseElve.BaseFluentAttributes;
     elve.CurrentFluentAttributes = baseElve.CurrentFluentAttributes;
     elve.Features = baseElve.Features;
     elve.GetModifiedFluentAttributes().Returns(new CharacterFluentAttributes { LifePoints = 20 });
     
     healthPotion.Apply(elve);
     elve.CurrentFluentAttributes.LifePoints.Should().Be(19);
 }