Beispiel #1
0
        private void VerifySerialization(TestAdjacencyGraph g)
        {
            GraphMLSerializer <TestVertex, TestEdge> serializer = new GraphMLSerializer <TestVertex, TestEdge>();

            using (StringWriter writer = new StringWriter())
            {
                serializer.Serialize(writer, g);
                String xml = writer.ToString();
                Console.WriteLine(xml);
                XmlAssert.IsWellFormedXml(xml);
            }
        }
Beispiel #2
0
        public void WriteVertex()
        {
            TestAdjacencyGraph g = new TestAdjacencyGraph();
            TestVertex         v = new TestVertex(
                "v1",
                "string",
                1,
                2,
                3.0,
                4.0F,
                true,
                new Dummy()
                );

            g.AddVertex(v);
            VerifySerialization(g);
        }
Beispiel #3
0
        public void WriteEdge()
        {
            {
                TestAdjacencyGraph g  = new TestAdjacencyGraph();
                TestVertex         v1 = new TestVertex(
                    "v1",
                    "string",
                    1,
                    2,
                    3.0,
                    4.0F,
                    true,
                    new Dummy()
                    );
                TestVertex v2 = new TestVertex(
                    "v2",
                    "string2",
                    5,
                    6,
                    7.0,
                    8.0F,
                    true,
                    new Dummy()
                    );

                g.AddVertex(v1);
                g.AddVertex(v2);

                TestEdge edge = new TestEdge(
                    v1, v2,
                    "e1",
                    "string",
                    9,
                    10,
                    11.0,
                    12.0F,
                    true,
                    new Dummy()
                    );
                g.AddEdge(edge);
                VerifySerialization(g);
            }
        }