Esempio n. 1
0
        public void GivenNodeWithoutLabelWhenWritingXmlThenLabelAttributeIsNotWritten()
        {
            const string XmlOutput = "<edge id=\"1\" source=\"2\" target=\"3\" weight=\"3.167\" type=\"directed\" />";
            GexfEdge     edge      = new GexfEdge(GexfEdgeType.Undirected)
            {
                Id = "1", Source = "2", Target = "3", EdgeType = GexfEdgeType.Directed, Weight = 3.167
            };
            XmlTestWriter writer = new XmlTestWriter(edge, XmlOutput);

            Assert.AreEqual(writer.ExpectedNormalizedXmlOutput, writer.ActualNormalizedXmlOutput);
        }
Esempio n. 2
0
        public IGexfEdge AddEdge(string id, IGexfNode source, IGexfNode target, GexfEdgeType edgeType, double weight, string label)
        {
            GexfEdge edge = new GexfEdge(DefaultEdgeType)
            {
                Id       = id,
                Source   = source.Id,
                Target   = target.Id,
                Weight   = weight,
                EdgeType = edgeType,
                Label    = label
            };

            _edgeList.Add(edge);
            return(edge);
        }
Esempio n. 3
0
        public void GivenNodeWhenWritingXmlThenIdAndLabelAreWritten()
        {
            GexfEdge edge1 = new GexfEdge(GexfEdgeType.Directed)
            {
                Id = "0", Source = "2", Target = "4"
            };
            GexfEdge edge2 = new GexfEdge(GexfEdgeType.Directed)
            {
                Id = "1", Source = "3", Target = "5"
            };
            GexfEdgeList edgeList = new GexfEdgeList();

            edgeList.Add(edge1);
            edgeList.Add(edge2);
            XmlTestWriter writer = new XmlTestWriter(edgeList, XmlOutput);

            Assert.AreEqual(writer.ExpectedNormalizedXmlOutput, writer.ActualNormalizedXmlOutput);
        }