public void InheritedActionPropertyFollowsSource() { bool childPropertyChanged = false; Event parentEvent = new Event(Workspace.Instance.GetPlugin(TriggerOccursEventType)); Action parentAction = new Action(Workspace.Instance.GetPlugin(FireTriggerActionType)); parentAction.SetProperty("Name", new Value("test", true)); parentEvent.AddStatement(parentAction); ReadOnlyEvent childEvent = new ReadOnlyEvent(parentEvent); AbstractProperty childProperty = ((AbstractAction)childEvent.Statements.Single()).GetProperty("Name"); childProperty.PropertyChanged += (sender, e) => childPropertyChanged |= (e.PropertyName == "Value"); parentAction.SetProperty("Name", new Value("test2", true)); Assert.AreEqual("test2", childProperty.Value.Reader.GetStrValue()); Assert.IsTrue(childPropertyChanged); }
public void SetActionProperty() { bool propertyFiredValueChange = false; Action action = new Action(Workspace.Instance.GetPlugin(FireTriggerActionType)); action.GetProperty("Name").PropertyChanged += (sender, e) => propertyFiredValueChange |= (e.PropertyName == "Value"); action.SetProperty("Name", new Value("test", true)); Assert.IsTrue(propertyFiredValueChange); Assert.AreEqual("test", action.GetProperty("Name").Value.Reader.GetStrValue()); }
public override sealed AbstractStatement DeepCopyStatement() { Action copy = new Action(this.Plugin); foreach (AbstractProperty property in this.Properties) { copy.SetProperty(property.Name, property.Value); } return copy; }