Exemple #1
0
        public void RegioGraaf_c_AddUndirectedEdge_3_DirectedAndUndirected()
        {
            // Arrange
            IGraph graph    = DSBuilder.CreateGraphEmpty();
            var    expected = StringWithoutSpaces(
                "A [ B(20) ] " +
                "B [ A(20) C(30) D(40) ] " +
                "C [ B(30) D(50) ] " +
                "D [ B(40) ] ");

            graph.GetVertex("A");
            graph.GetVertex("B");
            graph.GetVertex("C");
            graph.GetVertex("D");

            // Act
            graph.AddUndirectedEdge("A", "B", 20);
            graph.AddUndirectedEdge("B", "C", 30);
            graph.AddUndirectedEdge("B", "D", 40);
            graph.AddEdge("C", "D", 50);
            string actual = StringWithoutSpaces(graph.ToString());

            // Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void RegioGraaf_c_AddUndirectedEdge_1_OneAdded()
        {
            // Arrange
            IGraph graph    = DSBuilder.CreateGraphEmpty();
            var    expected = StringWithoutSpaces(
                "A [ X(2000) ] X [ A(2000) ]");

            graph.GetVertex("A");
            graph.GetVertex("X");

            // Act
            graph.AddUndirectedEdge("A", "X", 2000);
            string actual = StringWithoutSpaces(graph.ToString());

            // Assert
            Assert.AreEqual(expected, actual);
        }