Esempio n. 1
0
        public void SenseOfUrgency_WhenCityHasMultipleSenseOfUrgencyTechnologies_ShouldStackUpTo100Percent(
            ICity city,
            IStructure structure,
            BattleProcedure battleProcedure)
        {
            structure.State = GameObjectStateFactory.NormalState();
            structure.Stats.Hp.Returns(50m);
            structure.Stats.Base.Battle.MaxHp.Returns(200m);

            city.GetEnumerator().Returns(x =>
                                         new List <IStructure> {
                structure
            }.GetEnumerator());
            city.Technologies.GetEffects(EffectCode.SenseOfUrgency).Returns(new List <Effect>
            {
                new Effect {
                    Id = EffectCode.SenseOfUrgency, Value = new object[] { 50 }
                },
                new Effect {
                    Id = EffectCode.SenseOfUrgency, Value = new object[] { 25 }
                },
                new Effect {
                    Id = EffectCode.SenseOfUrgency, Value = new object[] { 50 }
                }
            });

            battleProcedure.SenseOfUrgency(city, 50);

            structure.Stats.Hp.Should().Be(100m);
        }
Esempio n. 2
0
        public void SenseOfUrgency_WhenCityHasNoSenseOfUrgencyTechnologies_HealsHurtStructuresThatArentInBattle(
            ICity city,
            IStructure inBattleStructure,
            IStructure fullyHealedStructure,
            IStructure hurtStructure,
            BattleProcedure battleProcedure)
        {
            inBattleStructure.State = GameObjectStateFactory.BattleState(0);
            inBattleStructure.Stats.Hp.Returns(50m);
            inBattleStructure.Stats.Base.Battle.MaxHp.Returns(100m);

            fullyHealedStructure.State = GameObjectStateFactory.NormalState();
            fullyHealedStructure.Stats.Hp.Returns(75m);
            fullyHealedStructure.Stats.Base.Battle.MaxHp.Returns(75m);

            hurtStructure.State = GameObjectStateFactory.NormalState();
            hurtStructure.Stats.Hp.Returns(100m);
            hurtStructure.Stats.Base.Battle.MaxHp.Returns(200m);

            city.GetEnumerator().Returns(x =>
                                         new List <IStructure> {
                inBattleStructure, fullyHealedStructure, hurtStructure
            }.GetEnumerator());
            city.Technologies.GetEffects(EffectCode.SenseOfUrgency).Returns(new List <Effect>
            {
                new Effect {
                    Id = EffectCode.SenseOfUrgency, Value = new object[] { 50 }
                }
            });

            battleProcedure.SenseOfUrgency(city, 50);

            inBattleStructure.Stats.Hp.Should().Be(50m);
            hurtStructure.Stats.Hp.Should().Be(125m);
            fullyHealedStructure.Stats.Hp.Should().Be(75m);

            hurtStructure.Received(1).BeginUpdate();
            hurtStructure.Received(1).EndUpdate();

            fullyHealedStructure.Received(0).BeginUpdate();
            fullyHealedStructure.Received(0).EndUpdate();

            inBattleStructure.Received(0).BeginUpdate();
            inBattleStructure.Received(0).EndUpdate();
        }