Beispiel #1
0
        public void StorageTest()
        {
            var acc = GetTestAcc();

            var oldEnergy     = acc.Energy.MaximumValue;
            var oldPopulation = acc.Population.MaximumValue;
            var oldPlutonium  = acc.Population.MaximumValue;
            var oldScrap      = acc.Scrap.MaximumValue;
            var oldTechnology = acc.Technology.MaximumValue;

            LogicRules.IncreaseWholeStorage(acc);

            Assert.AreNotEqual(oldEnergy, acc.Energy.MaximumValue);
            Assert.AreNotEqual(oldPopulation, acc.Population.MaximumValue);
            Assert.AreNotEqual(oldPlutonium, acc.Plutonium.MaximumValue);
            Assert.AreNotEqual(oldScrap, acc.Scrap.MaximumValue);
            Assert.AreNotEqual(oldTechnology, acc.Technology.MaximumValue);

            LogicRules.DecreaseWholeStorage(acc);

            Assert.AreEqual(oldEnergy, acc.Energy.MaximumValue);
            Assert.AreEqual(oldPopulation, acc.Population.MaximumValue);
            Assert.AreEqual(oldPlutonium, acc.Plutonium.MaximumValue);
            Assert.AreEqual(oldScrap, acc.Scrap.MaximumValue);
            Assert.AreEqual(oldTechnology, acc.Technology.MaximumValue);

            // Increase and Decrease Scrap Strorage
            var entity = new Entity(336, Core.Models.Definitions.EntityType.Scrapyard, acc, new PositionI(new Position(new LatLon(50.97695325, 11.02396488))), 100, 0);

            LogicRules.IncreaseStorage(acc, entity);

            Assert.AreNotEqual(oldScrap, acc.Scrap.MaximumValue);

            LogicRules.DecreasStorage(acc, entity);

            Assert.AreEqual(oldScrap, acc.Scrap.MaximumValue);

            // Increase and Decrease Population Strorage
            entity = new Entity(342, Core.Models.Definitions.EntityType.Tent, acc, new PositionI(new Position(new LatLon(50.97695325, 11.02396488))), 100, 0);

            LogicRules.IncreaseStorage(acc, entity);

            Assert.AreNotEqual(oldPopulation, acc.Population.MaximumValue);

            LogicRules.DecreasStorage(acc, entity);

            Assert.AreEqual(oldPopulation, acc.Population.MaximumValue);

            // Increase and Decrease Energy Strorage
            entity = new Entity(330, Core.Models.Definitions.EntityType.Transformer, acc, new PositionI(new Position(new LatLon(50.97695325, 11.02396488))), 100, 0);

            LogicRules.IncreaseStorage(acc, entity);

            Assert.AreNotEqual(oldEnergy, acc.Energy.MaximumValue);

            LogicRules.DecreasStorage(acc, entity);

            Assert.AreEqual(oldEnergy, acc.Energy.MaximumValue);
        }