示例#1
0
        /// <summary>
        /// Adds a new link
        /// </summary>
        /// <param name="link">Instance of <see cref="Link"/></param>
        public static void AddLink(Link link)
        {
            if (Links == null)
            {
                throw new InvalidOperationException("GraphHelper.Initialize() must be called first.");
            }

            Links.Add(link);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }