public GrowthZoneConnector(ZoneInfoGrid zoneInfoGrid, CancellationToken cancellationToken)
 {
     _cancellationToken   = cancellationToken;
     _roadZonesAndTraffic = zoneInfoGrid
                            .ZoneInfos
                            .Values
                            .Select(x => x.GetNetworkZoneConsumption <RoadZoneConsumption>())
                            .Where(x => x.HasMatch)
                            .Select(x => x.MatchingObject)
                            .ToDictionary(x => x, x => new TrafficDensity(x.GetTrafficDensityAsInt()));
 }
예제 #2
0
        private ZoneInfoGrid InitializeZoneInfoGrid(bool withHorizontalRiver, bool withVerticalRiver, bool withWoodlands)
        {
            var r = new RandomTerraformer(
                () => new WaterZoneConsumption(new ZoneInfoFinder(x => QueryResult <IZoneInfo> .Create())),
                () => new WoodlandZoneConsumption(new ZoneInfoFinder(x => QueryResult <IZoneInfo> .Create())));
            var zoneInfoGrid = new ZoneInfoGrid(100, MockRepository.GenerateMock <ILandValueCalculator>());

            var options = new TerraformingOptions()
            {
                HorizontalRiver = withHorizontalRiver,
                VerticalRiver   = withVerticalRiver
            };

            options.SetWoodlands(withWoodlands ? 10 : 0);
            options.SetLakes(0);

            r.ApplyWith(zoneInfoGrid, options);

            return(zoneInfoGrid);
        }