public void TestEndGroup()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            Assert.Throws<InvalidOperationException>(() =>
            {
                urr.EndGroup();
            });
        }
        public void TestPopRecordFromUndoStorage00()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            Assert.Throws<InvalidOperationException>(() =>
            {
                urr.PopRecordFromUndoStorage();
            });
        }
        public void TestRecordEdgeCreationForUndo01()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            Assert.Throws<ArgumentException>(() =>
            {
                urr.BeginGroup();
                urr.RecordEdgeCreationForUndo(null);
            });
        }
        public void TestRecordEdgeCreationForUndo00()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);
            EdgeController edgeController = new EdgeController(graphController);

            List<IVisualEdge> edgeList = new List<IVisualEdge>();
            VisualEdge edge = new VisualEdge(edgeController, EdgeType.ExplicitConnection);
            edgeList.Add(edge);

            Assert.Throws<InvalidOperationException>(() =>
            {
                urr.RecordEdgeCreationForUndo(edgeList);
            });
        }
        public void TestUndo()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            DeltaNodes deltaNodes = new DeltaNodes();
            bool result = urr.Undo(deltaNodes);
            Assert.AreEqual(false, result);
        }
        public void TestRecordRuntimeStatesForUndo00()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);
            RuntimeStates runtimeStates = new RuntimeStates();

            Assert.Throws<InvalidOperationException>(() =>
            {
                urr.RecordRuntimeStatesForUndo(runtimeStates);
            });
        }
        public void TestRecordNodeModificationForUndo02()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            urr.BeginGroup();
            urr.RecordNodeModificationForUndo(new List<IVisualNode>());
            Assert.AreEqual(0, urr.ActionCount);
        }
        public void TestRecordNodeModficationForUndo00()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            List<IVisualNode> nodeList = new List<IVisualNode>();
            DriverNode node = new DriverNode(graphController);
            nodeList.Add(node);

            Assert.Throws<InvalidOperationException>(() =>
            {
                urr.RecordNodeModificationForUndo(nodeList);
            });
        }
        public void TestRecordNodeDeletionForUndo01()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            urr.BeginGroup();
            urr.RecordNodeDeletionForUndo(null);
            Assert.AreEqual(0, urr.ActionCount);
        }
        public void TestRecordEdgeModificationForUndo02()
        {
            GraphController graphController = new GraphController(null);
            UndoRedoRecorder urr = new UndoRedoRecorder(graphController);

            Assert.Throws<ArgumentException>(() =>
            {
                urr.BeginGroup();
                urr.RecordEdgeModificationForUndo(new List<IVisualEdge>());
            });
        }
        private void InitializeInternal(IGraphVisualHost visualHost)
        {
            //The identity of this graph controller
            this.Identifier = GraphController.identifierCounter++;

            //Optional Object
            this.visualHost = visualHost;

            //Essential Object
            this.edgeController = new EdgeController(this);
            this.graphProperties = new GraphProperties();
            this.undoRedoRecorder = new UndoRedoRecorder(this);

            DrawingVisual visual = new DrawingVisual();
            this.selectionBox = new SelectionBox(this, this.visualHost);

            // Create a timer for auto-saving in the background.
            this.autoSaveTimer = new DispatcherTimer();
            this.autoSaveTimer.Interval = TimeSpan.FromSeconds(58);
            this.autoSaveTimer.Tick += OnAutoSaveTimerTicked;
        }