public void CloneTest()
        {
            // Arrange.
            const string Description = "Test Description";
            Action<TwoInOneOutExpressionNode> updateAction = node => { };
            Func<TwoInOneOutExpressionNode, bool> isValidFunc = node => true;

            var diagram = Mock.Create<IDiagramViewModel>(Behavior.Loose);
            var expression = new FormatValueExpression();
            var source = new FormatValueExpressionNode(diagram, expression)
                             {
                                 Description = Description,
                                 UpdateAction = updateAction,
                                 IsValidFunc = isValidFunc
                             };

            // Act.
            var clone = (FormatValueExpressionNode)source.Clone();

            // Assert.
            Assert.IsNotNull(clone);
            Assert.AreEqual(Description, clone.Description);
            Assert.AreSame(updateAction, clone.UpdateAction);
            Assert.AreSame(isValidFunc, clone.IsValidFunc);
        }
        public void TypePropertyReturnsFormatValue()
        {
            // Arrange.
            var expression = new FormatValueExpression();

            // Act / Assert.
            Assert.AreEqual(ExpressionNodeType.FormatValue, expression.Type);
        }
        public void CloneTest()
        {
            // Arrange.
            const string ExpressionName = "Test Expression";
            const string FunctionName = "Test Function";
            const double Width = 123;
            const double Height = 456;
            const double Top = 111;
            const double Left = 222;
            const string ConnectorName1 = "Connector 1";
            const string ConnectorName2 = "Connector 2";
            const string ConnectorNameOut = "Connector Out";
            var connectorId1 = new Guid("{A172E268-7C51-48B4-BA0F-CC6E068C566C}");
            var connectorId2 = new Guid("{E22C1C37-A147-41C1-9CFE-7ACF208BCE6E}");
            var connectorIdOut = new Guid("{1DBB2CE7-F67E-41CF-A092-EF81FB1F7460}");

            var source = new FormatValueExpression
                             {
                                 ExpressionName = ExpressionName,
                                 FunctionName = FunctionName,
                                 Width = Width,
                                 Height = Height,
                                 Top = Top,
                                 Left = Left,
                                 Connector1In = { Id = connectorId1, Name = ConnectorName1 },
                                 Connector2In = { Id = connectorId2, Name = ConnectorName2 },
                                 ConnectorOut = { Id = connectorIdOut, Name = ConnectorNameOut }
                             };

            // Act.
            var clone = (FormatValueExpression)source.Clone();

            // Assert.
            Assert.IsNotNull(clone);
            Assert.AreEqual(ExpressionName, clone.ExpressionName);
            Assert.AreEqual(FunctionName, clone.FunctionName);
            Assert.AreEqual(Width, clone.Width);
            Assert.AreEqual(Height, clone.Height);
            Assert.AreEqual(Top, clone.Top);
            Assert.AreEqual(Left, clone.Left);
            
            Assert.AreNotEqual(connectorId1, clone.Connector1In.Id);
            Assert.AreEqual(ConnectorName1, clone.Connector1In.Name);
            
            Assert.AreNotEqual(connectorId2, clone.Connector2In.Id);
            Assert.AreEqual(ConnectorName2, clone.Connector2In.Name);

            Assert.AreNotEqual(connectorIdOut, clone.ConnectorOut.Id);
            Assert.AreEqual(ConnectorNameOut, clone.ConnectorOut.Name);
        }
示例#4
0
        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns>The ExpressionObjectBase.</returns>
        public override ExpressionObjectBase Clone()
        {
            var clone = new FormatValueExpression
                            {
                                ExpressionName = ExpressionName,
                                FunctionName = FunctionName,
                                Width = Width,
                                Height = Height,
                                Top = Top,
                                Left = Left,
                            };

            Connector1In.Clone(clone.Connector1In);
            Connector2In.Clone(clone.Connector2In);
            ConnectorOut.Clone(clone.ConnectorOut);

            return clone;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="FormatValueExpressionNode"/> class.
 /// </summary>
 /// <param name="diagramViewModel">
 /// The diagram view model.
 /// </param>
 /// <param name="expressionObject">
 /// The expression object.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="expressionObject"/> parameter is null.
 /// </exception>
 public FormatValueExpressionNode(IDiagramViewModel diagramViewModel, FormatValueExpression expressionObject)
     : base(diagramViewModel, expressionObject)
 {
     _diagramViewModel = diagramViewModel;
 }
示例#6
0
 private static void AddFieldNode(FormatValueExpression item, IDiagramViewModel diagramViewModel)
 {
     var node = new FormatValueExpressionNode(diagramViewModel, item);
     diagramViewModel.Items.Add(new NodeViewModel<FormatValueExpressionNode, ExpressionConnection>(node, diagramViewModel));
 }