예제 #1
0
        public void AppliesEmpireSystemLoss()
        {
            var starSystem = new StarSystem {
                Id = ObjectId.GenerateNewId()
            };
            var empire = new Empire {
                Id = ObjectId.GenerateNewId(), StarSystemsIds = new ObjectId[0]
            };

            _simulationView.Empires     = new Empire[] { empire };
            _simulationView.StarSystems = new StarSystem[] { starSystem };
            _deltaSet.DeltaObjectIds    = new Delta <ObjectId>[]
            {
                new Delta <ObjectId> {
                    DeltaType = DeltaType.EmpireSystemLoss, ReferenceId = empire.Id, Value = starSystem.Id
                }
            };

            var result         = _deltaApplier.GetForTick(It.IsAny <ObjectId>(), It.IsAny <int>());
            var resultEmpire   = Assert.Single(result.Empires);
            var resultSystemId = Assert.Single(resultEmpire.StarSystemsIds);

            Assert.Equal(starSystem.Id, resultSystemId);
        }
예제 #2
0
        public void AppliesSystemDevelopment()
        {
            var starSystem = new StarSystem {
                Id = ObjectId.GenerateNewId(), Development = 430.0
            };

            _simulationView.StarSystems = new StarSystem[] { starSystem };
            _deltaSet.DeltaDoubles      = new Delta <double>[]
            {
                new Delta <double> {
                    DeltaType = DeltaType.SystemDevelopment, ReferenceId = starSystem.Id, Value = 120.0
                },
                new Delta <double> {
                    DeltaType = DeltaType.SystemDevelopment, ReferenceId = ObjectId.GenerateNewId(), Value = 90.0
                },
                new Delta <double> {
                    DeltaType = DeltaType.SystemDevelopment, ReferenceId = starSystem.Id, Value = 35.0
                }
            };

            var result = _deltaApplier.GetForTick(It.IsAny <ObjectId>(), It.IsAny <int>());

            Assert.Equal(275.0, result.StarSystems.Single().Development);
        }
예제 #3
0
 private bool IsSystemInRadius(StarSystem system, IEnumerable <Coordinate> inRadiusCoordinates) =>
 inRadiusCoordinates.Any(coord => system.Coordinate.X == coord.X && system.Coordinate.Y == coord.Y);