public void GetValueForCiv_ExtractsFromAllBuildingsInAllCities() { var civ = BuildCiv( BuildCity(BuildBuilding(BuildTemplate())), BuildCity(BuildBuilding(BuildTemplate()), BuildBuilding(BuildTemplate())), BuildCity(BuildBuilding(BuildTemplate()), BuildBuilding(BuildTemplate()), BuildBuilding(BuildTemplate())) ); Func <ISocialPolicyBonusesData, int> policyExtractor = bonuses => 0; Func <IBuildingTemplate, int> globalBuildingExtractor = template => 1; Func <int, int, int> aggregator = (a, b) => a + b; var modifier = new CivModifier <int>( new CivModifier <int> .ExtractionData() { PolicyExtractor = policyExtractor, GlobalBuildingExtractor = globalBuildingExtractor, Aggregator = aggregator, UnitaryValue = 1 } ); Container.Inject(modifier); Assert.AreEqual(7, modifier.GetValueForCiv(civ)); }
public void GetValueForCiv_ExtractsFromSocialPolicyBonuses() { var civ = BuildCiv(); Func <ISocialPolicyBonusesData, int> policyExtractor = bonuses => 1; Func <IBuildingTemplate, int> globalBuildingExtractor = template => 0; Func <int, int, int> aggregator = (a, b) => a + b; var modifier = new CivModifier <int>( new CivModifier <int> .ExtractionData() { PolicyExtractor = policyExtractor, GlobalBuildingExtractor = globalBuildingExtractor, Aggregator = aggregator, UnitaryValue = 1 } ); MockSocialPolicyCanon.Setup(canon => canon.GetPolicyBonusesForCiv(civ)).Returns( new List <ISocialPolicyBonusesData>() { BuildPolicyBonuses(), BuildPolicyBonuses(), BuildPolicyBonuses(), } ); Container.Inject(modifier); Assert.AreEqual(4, modifier.GetValueForCiv(civ)); }