public void Handle(SimulationStatusChangedEvent eventToHandle) { if (!CanHandle(eventToHandle)) { return; } updateAllTrafficLights(); }
protected override void Context() { base.Context(); _simulation = A.Fake <IMoBiSimulation>(); _simulation.Id = "toto"; _simulationStatusChangedEvent = new SimulationStatusChangedEvent(_simulation); _simulationNode = new Nodes.TextNode("Simulation"); var buildConfiguration = A.Fake <IMoBiBuildConfiguration>(); var spatialStructure = A.Fake <IMoBiSpatialStructure>().WithId("SpatialStructure"); spatialStructure.Version = 5; var templateSpatialStructure = A.Fake <IMoBiSpatialStructure>().WithId("TemplateSpatialStructure"); var spatialStructureInfo = new SpatialStructureInfo(); spatialStructureInfo.TemplateBuildingBlock = templateSpatialStructure; spatialStructureInfo.BuildingBlock = spatialStructure; buildConfiguration.SpatialStructureInfo = spatialStructureInfo; A.CallTo(() => buildConfiguration.BuildingInfoForTemplateById(spatialStructureInfo.TemplateBuildingBlockId)).Returns(spatialStructureInfo); var moleculesInfo = new MoleculesInfo(); var templateBuildingBlock = A.Fake <IMoleculeBuildingBlock>().WithId("TemplateMolecules"); var moleculeBuildingBlock = A.Fake <IMoleculeBuildingBlock>().WithId("Molecules"); moleculesInfo.TemplateBuildingBlock = templateBuildingBlock; moleculesInfo.BuildingBlock = moleculeBuildingBlock; A.CallTo(() => buildConfiguration.BuildingInfoForTemplateById(moleculesInfo.TemplateBuildingBlockId)).Returns(moleculesInfo); buildConfiguration.MoleculesInfo = moleculesInfo; A.CallTo(() => buildConfiguration.AllBuildingBlockInfos()).Returns(new IBuildingBlockInfo[] { spatialStructureInfo, moleculesInfo }); A.CallTo(() => buildConfiguration.HasChangedBuildingBlocks()).Returns(true); _buildingBlockInfoDTOChanged = spatialStructureInfo; _buildingBlockInfoDTOUnchanged = moleculesInfo; _treeView = A.Fake <IUxTreeView>(); var configNode = new BuildConfigurationNode(buildConfiguration).Under(_simulationNode); _nodeToChange = new BuildingBlockInfoNode(_buildingBlockInfoDTOChanged) .WithIcon(ApplicationIcons.SpatialStructureGreen) .Under(configNode); _nodeNotToChange = new BuildingBlockInfoNode(_buildingBlockInfoDTOUnchanged) .WithIcon(ApplicationIcons.MoleculeGreen) .Under(configNode); A.CallTo(() => _view.TreeView).Returns(_treeView); A.CallTo(() => _treeView.NodeById(_simulation.Id)).Returns(_simulationNode); A.CallTo(() => _simulation.MoBiBuildConfiguration).Returns(buildConfiguration); }
public void Handle(SimulationStatusChangedEvent eventToHandle) { updateSimulationNode(eventToHandle.Simulation as Simulation); }