public void DeletingNodesShouldNotMakeTransposeFailCausingCrash()
        {
            TaskStateChangedEventHandler evaluationDidNotFailHandler =
                (DynamoScheduler sender, TaskStateChangedEventArgs args) =>
            {
                Assert.AreNotEqual(TaskStateChangedEventArgs.State.ExecutionFailed, args.CurrentState);
            };

            try
            {
                Model.Scheduler.TaskStateChanged += evaluationDidNotFailHandler;

                // Open graph
                Open(@"core\regressions\front_grill_error_standalone.dyn");

                // Delete node group
                var workspaceVM = ViewModel.Workspaces.First() as HomeWorkspaceViewModel;
                var groupVM     = workspaceVM.Annotations.First(a => a.AnnotationText == "Delete causes errors");
                groupVM.Select();
                groupVM.WorkspaceViewModel.DynamoViewModel.DeleteCommand.Execute(null);

                // The graph run successfully and, more importantly, execution did not cause a crash.
                Assert.IsTrue(workspaceVM.IsInIdleState);
                Assert.AreEqual(NotificationLevel.Mild, workspaceVM.CurrentNotificationLevel);
            }
            finally
            {
                Model.Scheduler.TaskStateChanged -= evaluationDidNotFailHandler;
            }
        }
Esempio n. 2
0
        public void DeletingImperativeCBNShouldNotLeadToCrash()
        {
            TaskStateChangedEventHandler evaluationDidNotFailHandler =
                (DynamoScheduler sender, TaskStateChangedEventArgs args) =>
            {
                Assert.AreNotEqual(TaskStateChangedEventArgs.State.ExecutionFailed, args.CurrentState);
            };

            try
            {
                CurrentDynamoModel.Scheduler.TaskStateChanged += evaluationDidNotFailHandler;
                OpenModel(@"core\imperative\delete_imperative_cbn_crash.dyn");
                AssertPreviewValue("0692b19256834a9187f3bcd500d513f1", 5.86);
                CurrentDynamoModel.ExecuteCommand(new DeleteModelCommand("45f0db0f-c014-481e-9b7f-939da54f2adc"));
                CurrentDynamoModel.ExecuteCommand(new DeleteModelCommand("235f53ba-d913-45d0-986a-b9c6588cba45"));
                AssertPreviewValue("0692b19256834a9187f3bcd500d513f1", 5.86);
                Assert.AreEqual(2, CurrentDynamoModel.CurrentWorkspace.Nodes.Count());
            }
            finally
            {
                CurrentDynamoModel.Scheduler.TaskStateChanged -= evaluationDidNotFailHandler;
            }
        }