Example #1
0
        public void Defect_MAGN_3166()
        {
            // Create the node with given information.
            NodeModel node =
                new DSVarArgFunction(CurrentDynamoModel.LibraryServices.GetFunctionDescriptor("DSCore.List.Join@var[]..[]"));
            CurrentDynamoModel.ExecuteCommand(new DynCmd.CreateNodeCommand(node, 0, 0, true, false));

            var nodeGuid = node.GUID;

            // The node sound be found, and it should be a DSVarArgFunction.
            var workspace = CurrentDynamoModel.CurrentWorkspace;
            Assert.IsNotNull(node);

            // Delete the node and ensure it is gone.
            CurrentDynamoModel.ExecuteCommand(new DynCmd.DeleteModelCommand(nodeGuid));
            node = workspace.NodeFromWorkspace(nodeGuid);
            Assert.IsNull(node);

            // Perform undo operation.
            var undoOperation = DynCmd.UndoRedoCommand.Operation.Undo;
            CurrentDynamoModel.ExecuteCommand(new DynCmd.UndoRedoCommand(undoOperation));

            // Now that deletion is undone, ensure the node exists.
            node = workspace.NodeFromWorkspace(nodeGuid);
            Assert.IsNotNull(node);
            Assert.IsNotNull(node as DSVarArgFunction);
        }
Example #2
0
        public void CanCopyAndPasteDSVarArgFunctionNode()
        {
            Assert.AreEqual(0, CurrentDynamoModel.CurrentWorkspace.Nodes.Count());

            const string dsVarArgFunctionName = "DSCore.String.Split@string,string[]";
            var node = new DSVarArgFunction(CurrentDynamoModel.LibraryServices.GetFunctionDescriptor(dsVarArgFunctionName));
            CurrentDynamoModel.CurrentWorkspace.AddNode(node, false);

            // Here we check to see if we do get a DSVarArgFunction node (which
            // is what this test case is written for, other nodes will render the 
            // test case meaningless).
            // 
            Assert.AreEqual(1, CurrentDynamoModel.CurrentWorkspace.Nodes.Count());

            CurrentDynamoModel.AddToSelection(node); // Select the only DSVarArgFunction node.
            CurrentDynamoModel.Copy(); // Copy the only DSVarArgFunction node.

            Assert.DoesNotThrow(() =>
            {
                CurrentDynamoModel.Paste(); // Nope, paste should not crash Dynamo.
            });
        }