public override void UpdateInternalFrom(IBuildingBlockChangeCommand originalCommand) { base.UpdateInternalFrom(originalCommand); var editChangeCommand = originalCommand.DowncastTo <EditParameterCommand>(); _alteredOn = editChangeCommand._alteredOn; }
public static T AsInverseFor <T>(this T inverseCommand, IBuildingBlockChangeCommand originalCommand) where T : IBuildingBlockChangeCommand { CommandExtensions.AsInverseFor(inverseCommand, originalCommand); inverseCommand.IncrementVersion = !originalCommand.IncrementVersion; inverseCommand.UpdateInternalFrom(originalCommand); return(inverseCommand); }
public override void UpdateInternalFrom(IBuildingBlockChangeCommand buildingBlockChangeCommand) { base.UpdateInternalFrom(buildingBlockChangeCommand); var editChangeCommand = buildingBlockChangeCommand.DowncastTo <EditParameterCommand>(); AlteredOn = editChangeCommand.AlteredOn; }
protected override void Context() { base.Context(); _id = "tralala"; _buildingBlock = A.Fake <IPKSimBuildingBlock>(); _command = A.Fake <IBuildingBlockChangeCommand>(); A.CallTo(() => _command.BuildingBlockId).Returns(_id); A.CallTo(() => _withIdRepository.ContainsObjectWithId(_id)).Returns(true); A.CallTo(() => _withIdRepository.Get(_id)).Returns(_buildingBlock); }
protected override void Context() { base.Context(); _buildingBlockStructureChangeCommand = A.Fake <IBuildingBlockStructureChangeCommand>(); A.CallTo(() => _buildingBlockStructureChangeCommand.ShouldChangeVersion).Returns(true); A.CallTo(() => _buildingBlockStructureChangeCommand.IncrementVersion).Returns(false); _buidlingBlock = A.Fake <IPKSimBuildingBlock>(); _buidlingBlock.Version = 8; _buidlingBlock.StructureVersion = 5; }
public override void UpdateInternalFrom(IBuildingBlockChangeCommand buildingBlockChangeCommand) { base.UpdateInternalFrom(buildingBlockChangeCommand); var setParameterValueCommand = buildingBlockChangeCommand as SetParameterValueCommand; if (setParameterValueCommand == null) { return; } _fixedValueSetHere = setParameterValueCommand._fixedValueSetHere; }
public void UpdateBuildingBlockVersion(IBuildingBlockChangeCommand buildingBlockChangeCommand) { var buildingBlock = Get <IPKSimBuildingBlock>(buildingBlockChangeCommand.BuildingBlockId); _buildingBlockVersionUpdater.UpdateBuildingBlockVersion(buildingBlockChangeCommand, buildingBlock); if (buildingBlock == null) { return; } buildingBlock.HasChanged = true; }
protected override void Context() { base.Context(); _version = 5; _buildingBlockChangeCommand = A.Fake <IBuildingBlockChangeCommand>(); A.CallTo(() => _buildingBlockChangeCommand.ShouldChangeVersion).Returns(true); A.CallTo(() => _buildingBlockChangeCommand.BuildingBlockId).Returns(_buildingBlockId); _buildingBlockId = "tralala"; _buildingBlock = A.Fake <IPKSimBuildingBlock>(); _buildingBlock.Version = _version; }
public override void UpdateInternalFrom(IBuildingBlockChangeCommand originalCommand) { base.UpdateInternalFrom(originalCommand); var switchDistributionTypeCommand = originalCommand as SwitchAdvancedParameterDistributionTypeCommand; if (switchDistributionTypeCommand == null) { return; } _newDistributedParameter = switchDistributionTypeCommand._oldDistributedParameter; _oldDistributedParameter = switchDistributionTypeCommand._newDistributedParameter; }
public void UpdateBuildingBlockVersion(IBuildingBlockChangeCommand buildingBlockChangeCommand, IPKSimBuildingBlock buildingBlock) { if (buildingBlock == null) { return; } if (!buildingBlockChangeCommand.ShouldChangeVersion) { return; } if (buildingBlockChangeCommand.IncrementVersion) { buildingBlock.Version++; } else { buildingBlock.Version--; } bool isStructureChangeCommand = buildingBlockChangeCommand.IsAnImplementationOf <IBuildingBlockStructureChangeCommand>(); if (isStructureChangeCommand) { if (buildingBlockChangeCommand.IncrementVersion) { buildingBlock.StructureVersion++; } else { buildingBlock.StructureVersion--; } } var simulation = buildingBlock as Simulation; if (simulation != null) { _buildingBlockInSimulationManager.UpdateStatusForSimulation(simulation); } else { _buildingBlockInSimulationManager.UpdateStatusForSimulationUsing(buildingBlock); } }
protected override void Context() { _buildingBlockChangeCommand = A.Fake <IBuildingBlockChangeCommand>(); _inverseBuildingBlockChangeCommand = A.Fake <IBuildingBlockChangeCommand>(); }
/// <summary> /// Allows the inverse command to be updated with some internal parameter of the original command /// that are not passed in constructor /// </summary> /// <param name="originalCommand">The original building block command</param> public virtual void UpdateInternalFrom(IBuildingBlockChangeCommand originalCommand) { ShouldChangeVersion = originalCommand.ShouldChangeVersion; }