Example #1
0
        /// <summary>
        /// Adds a new node
        /// </summary>
        /// <param name="node">Instance of <see cref="Node"/></param>
        public static void AddNode(Node node)
        {
            if (Nodes == null)
            {
                throw new InvalidOperationException("GraphHelper.Initialize() must be called first.");
            }

            Nodes.Add(node);
        }
Example #2
0
        public void TestSave_CategoriesDgml()
        {
            Node first = new Node("1", "first", "number");
            Node second = new Node("2", "second");
            Link link = new Link("1", "2", "connects", "link");
            Category[] categories =
            {
                new Category("number", "Green"),
                new Category("link", stroke: "Black", basedOn: "number"),
            };

            Graph graph = new Graph()
            {
                Nodes = new[] { first, second },
                Links = new[] { link },
                Categories = categories,
            };

            string actualDgml = graph.ToDgml();

            MatchDgml(CategoriesDgml, actualDgml);
        }
Example #3
0
        public void TestSave_StyledDgml()
        {
            Node first = new Node("1", "first", "category");
            Node second = new Node("2", "second");
            Link link = new Link("1", "2", "connects");
            Style style = new Style("category", "#FF000000");

            Graph graph = new Graph()
            {
                Nodes = new[] { first, second },
                Links = new[] { link },
                Styles = new[] { style },
            };

            string actualDgml = graph.ToDgml();

            MatchDgml(StyledDgml, actualDgml);
        }
Example #4
0
        public void TestSave_ValidDgml()
        {
            Node first = new Node("1", "first");
            Node second = new Node("2", "second");
            Link link = new Link("1", "2", "connects");

            Graph graph = new Graph()
            {
                Nodes = new[] { first, second },
                Links = new[] { link },
            };

            string actualDgml = graph.ToDgml();

            MatchDgml(ValidDgml, actualDgml);
        }