public void AppliesMetadataToDeltas() { var view = SetupGrowthCalculator(); var metadata = new DeltaMetadata(ObjectId.GenerateNewId(), 51); _economicSimulator.RunEmpire(metadata, It.IsAny <ObjectId>()); _starSystemRepository.Verify(x => x.ApplyDevelopment( It.Is <IEnumerable <Delta <double> > >( deltas => deltas.All( delta => delta.SimulationId == metadata.SimulationId && delta.Tick == metadata.Tick))), Times.Once); }
public void WriteMetadata(DeltaMetadata metadata) { decorated.WriteMetadata(metadata); }
public void CreatesDeltasWithCorrectValues() { var simulationId = ObjectId.GenerateNewId(); var metadata = new DeltaMetadata(simulationId, 54); var empireSystems = new StarSystem[] { new StarSystem(), new StarSystem(), new StarSystem(), new StarSystem(), new StarSystem() }; var borderingSystems = new StarSystem[] { new StarSystem(), new StarSystem(), new StarSystem(), new StarSystem(), new StarSystem() }; var view = new EmpireBorderView { Empire = new Empire(), EmpireSystems = empireSystems, BorderingEmpire = new Empire(), BorderingEmpireSystems = borderingSystems }; _economicSimulator.ApplyDamage(metadata, view, 324, 4224.56); foreach (var system in empireSystems) { _starSystemRepository.Verify( x => x.ApplyDamage( It.Is <IEnumerable <Delta <double> > >( deltas => deltas.Any( delta => delta.DeltaType == DeltaType.SystemDevelopment && delta.SimulationId == simulationId && delta.Tick == 54 && delta.ReferenceId == system.Id && delta.Value == 324))), Times.Once); } foreach (var system in borderingSystems) { _starSystemRepository.Verify( x => x.ApplyDamage( It.Is <IEnumerable <Delta <double> > >( deltas => deltas.Any( delta => delta.DeltaType == DeltaType.SystemDevelopment && delta.SimulationId == simulationId && delta.Tick == 54 && delta.ReferenceId == system.Id && delta.Value == 4224.56))), Times.Once); } }