public override ExpressionObjectBase Clone() { var clone = new ConditionExpression { ExpressionName = ExpressionName, FunctionName = FunctionName, Width = Width, Height = Height, Top = Top, Left = Left }; Connector1In.Clone(clone.Connector1In); Connector2In.Clone(clone.Connector2In); Connector3In.Clone(clone.Connector3In); ConnectorOut.Clone(clone.ConnectorOut); return clone; }
public void CloneTest() { var source = new ConditionExpression { ExpressionName = "source", Width = 1, Height = 2, Top = 3, Left = 4, ConnectorOut = { Name = "4" } }; var cloneTo = (ConditionExpression)source.Clone(); Assert.AreEqual(source.ExpressionName, cloneTo.ExpressionName); Assert.AreEqual(source.Width, cloneTo.Width); Assert.AreEqual(source.Height, cloneTo.Height); Assert.AreEqual(source.Top, cloneTo.Top); Assert.AreEqual(source.Left, cloneTo.Left); Assert.AreNotEqual(source.Id, cloneTo.Id); Assert.AreNotEqual(source.ConnectorOut.Id, cloneTo.ConnectorOut.Id); Assert.AreNotEqual(source.Connector1In.Id, cloneTo.Connector1In.Id); Assert.AreNotEqual(source.Connector2In.Id, cloneTo.Connector2In.Id); Assert.AreNotEqual(source.Connector3In.Id, cloneTo.Connector3In.Id); Assert.AreEqual(source.ConnectorOut.Name, cloneTo.ConnectorOut.Name); }
/// <summary> /// Adds the field node. /// </summary> /// <param name="item">The item.</param> /// <param name="diagramViewModel">The diagram view model.</param> private static void AddFieldNode(ConditionExpression item, IDiagramViewModel diagramViewModel) { var node = new ConditionExpressionNode(diagramViewModel, item); diagramViewModel.Items.Add(new NodeViewModel<ConditionExpressionNode, ExpressionConnection>(node, diagramViewModel)); }
/// <summary> /// Initializes a new instance of the <see cref="ConditionExpressionNode"/> class. /// </summary> /// <param name="diagramViewModel">The diagram view model.</param> /// <param name="expressionObject">The expression object.</param> public ConditionExpressionNode(IDiagramViewModel diagramViewModel, ConditionExpression expressionObject) : base(diagramViewModel, expressionObject) { _diagramViewModel = diagramViewModel; }