public void Test_AddAttribute() { GraphVizProcessor gvp = new GraphVizProcessor(); gvp.graph = new Graph(GraphType.Digraph, new Stmt_list()); //Graph, Node, Edge attribute gvp.AddAttribute(AttrType.Graph, new IDisID("x", "y")); string tmp = gvp.graph.ToCode(); if (!tmp.Contains("graph [x=y;]")) { Assert.Fail("Attr_stmt type attribute not found."); } //Specific node attribute gvp.AddNode("a"); gvp.AddAttribute(AttrType.SpecificNode, new IDisID("x", "y"), "a"); tmp = gvp.graph.ToCode(); if (!tmp.Contains("a [x=y;]")) { Assert.Fail("Node attribute not found."); } //Specific node attribute gvp.AddEdge("a", "b"); gvp.AddAttribute(AttrType.SpecificEdge, new IDisID("x", "y"), "a", "b"); tmp = gvp.graph.ToCode(); if (!tmp.Contains("a -> b [x=y;]")) { Assert.Fail("Edge attribute not found."); } }