Пример #1
0
        public void ProductionIsCappedWhenConfiguredTo()
        {
            _configuration.Setup(x => x.CapMilitaryProduction)
            .Returns(true);
            _militaryCalculator = new MilitaryCalculator(_configuration.Object, _random.Object);
            var militaryCap = 2000.0 * Parameters.MilitaryCapDevelopmentProportion;

            _empire.Empire.Military = militaryCap;
            var result = _militaryCalculator.ProductionForEmpire(_empire);

            Assert.Equal(0.0, result);

            _empire.Empire.Military = militaryCap - 500.0;
            result = _militaryCalculator.ProductionForEmpire(_empire);
            Assert.Equal(500.0, result);
        }
Пример #2
0
        public void ProductionIsNegativeIfDevelopmentCannotSustainCurrentMilitary()
        {
            _configuration.Setup(x => x.CapMilitaryProduction)
            .Returns(true);
            _militaryCalculator = new MilitaryCalculator(_configuration.Object, _random.Object);
            var militaryCap = 2000.0 * Parameters.MilitaryCapDevelopmentProportion;

            _empire.Empire.Military = militaryCap + 500.0;
            var result = _militaryCalculator.ProductionForEmpire(_empire);

            Assert.Equal(-500.0, result);
        }
Пример #3
0
        public void ProductionIsZeroWhenNoSystemsPresent()
        {
            var empire = new EmpireSystemsView
            {
                Empire = new Empire {
                    Alignment = new Alignment {
                        Power = 1.0
                    }
                },
                StarSystems = new StarSystem[0]
            };

            var result = _militaryCalculator.ProductionForEmpire(empire);

            Assert.Equal(0, result);
        }
Пример #4
0
        private void ApplyMilitaryProduction(DeltaMetadata deltaMetadata, EmpireSystemsView empire)
        {
            var production = _militaryCalculator.ProductionForEmpire(empire);

            _empireRepository.ApplyMilitaryProduction(deltaMetadata, empire.Empire.Id, production);
        }