Ejemplo n.º 1
0
        /// <summary>
        /// Run the dyn file and get all preview values in string representation.
        /// Then, iterate all nodes, for each iteration, choose a node and convert
        /// the remaining nodes to code, and compare the preview value of this
        /// node against with its original value.
        /// </summary>
        /// <param name="dynFilePath"></param>
        protected void MutationTest(string dynFilePath)
        {
            Dictionary <Guid, string> previewMap = new Dictionary <Guid, string>();

            RunModel(dynFilePath);

            foreach (var node in CurrentDynamoModel.CurrentWorkspace.Nodes)
            {
                previewMap[node.GUID] = GetStringData(node.GUID);
            }

            var nodes = CurrentDynamoModel.CurrentWorkspace.Nodes.Select(n => n.GUID).ToList();

            foreach (var node in nodes)
            {
                SelectAllExcept(node);
                var command = new DynamoModel.ConvertNodesToCodeCommand();
                CurrentDynamoModel.ExecuteCommand(command);
                CurrentDynamoModel.ForceRun();

                var preValue     = previewMap[node];
                var currentValue = GetStringData(node);
                Assert.AreEqual(preValue, currentValue);

                var undo = new DynamoModel.UndoRedoCommand(DynamoModel.UndoRedoCommand.Operation.Undo);
                CurrentDynamoModel.ExecuteCommand(undo);
            }
        }
Ejemplo n.º 2
0
        public void Reorder_7573()
        {
            // Original defect: http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-7573

            var dynFilePath = Path.Combine(TestDirectory, @"core\dsevaluation\reorder.dyn");

            RunModel(dynFilePath);

            AssertPreviewValue("c739b941-ece7-4b87-ae69-9a16f04dbe5d", new object[] { null, null, null, null });

            // Reset engine and mark all nodes as dirty. A.k.a., force re-execute.
            CurrentDynamoModel.ForceRun();

            AssertPreviewValue("79d158b3-fa40-4069-8bb5-153e6fb13858", new object[] { 2, 3, 6, 5 });
        }
Ejemplo n.º 3
0
        public void Regress_Magn_4837()
        {
            // Test nested custom node: run and reset engine and re-run.
            // Original defect: http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-4837

            var dynFilePath = Path.Combine(TestDirectory, @"core\CustomNodes\Regress_Magn_4837.dyn");

            RunModel(dynFilePath);

            AssertPreviewValue("42693721-622d-475e-a82e-bfe793ddc153", new object[] { 2, 3, 4, 5, 6 });

            // Reset engine and mark all nodes as dirty. A.k.a., force re-execute.
            CurrentDynamoModel.ForceRun();

            AssertPreviewValue("42693721-622d-475e-a82e-bfe793ddc153", new object[] { 2, 3, 4, 5, 6 });
        }
Ejemplo n.º 4
0
        public void Removekey_7573()
        {
            // Original defect: http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-7573

            var dynFilePath = Path.Combine(TestDirectory, @"core\dsevaluation\removekey.dyn");

            RunModel(dynFilePath);
            // Fix expected result after MAGN-7639 is fixed.

            AssertPreviewValue("bd89982a-c3e6-4a4e-898c-2bdc8f1f8c3e", false);

            // Reset engine and mark all nodes as dirty. A.k.a., force re-execute.
            CurrentDynamoModel.ForceRun();

            // Fix expected result after MAGN-7639 is fixed.
            AssertPreviewValue("980dcd47-84e7-412c-8d9e-d66f166d2370", true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Run the dyn file and get all preview values in string representation.
        /// Undo, force run and get all preview values in string representation.
        /// These two sets of preview value should be the same.
        /// </summary>
        /// <param name="dynFilePath"></param>
        protected void UndoTest(string dynFilePath)
        {
            Dictionary <Guid, string> previewMap = new Dictionary <Guid, string>();

            RunModel(dynFilePath);

            foreach (var node in CurrentDynamoModel.CurrentWorkspace.Nodes)
            {
                previewMap[node.GUID] = GetStringData(node.GUID);
            }

            int nodeCount      = CurrentDynamoModel.CurrentWorkspace.Nodes.Count();
            int connectorCount = CurrentDynamoModel.CurrentWorkspace.Connectors.Count();

            SelectAll();
            var command = new DynamoModel.ConvertNodesToCodeCommand();

            CurrentDynamoModel.ExecuteCommand(command);
            CurrentDynamoModel.ForceRun();

            var undo = new DynamoModel.UndoRedoCommand(DynamoModel.UndoRedoCommand.Operation.Undo);

            CurrentDynamoModel.ExecuteCommand(undo);
            CurrentDynamoModel.ForceRun();

            // Verify after undo everything is OK
            Assert.AreEqual(nodeCount, CurrentDynamoModel.CurrentWorkspace.Nodes.Count());
            Assert.AreEqual(connectorCount, CurrentDynamoModel.CurrentWorkspace.Connectors.Count());

            foreach (var node in CurrentDynamoModel.CurrentWorkspace.Nodes)
            {
                Assert.IsTrue(previewMap.ContainsKey(node.GUID));
                var preValue     = previewMap[node.GUID];
                var currentValue = GetStringData(node.GUID);
                Assert.AreEqual(preValue, currentValue);
            }
        }