public void GraphWithAdjList_GetVertex_NullArgument_ThrowsException()
        {
            // Arrange
            IGraph <string, int> graph = new GraphWithAdjList <string, int>();
            var exceptionThrown        = false;

            // Act
            try
            {
                graph.GetVertex(null);
            }
            catch (ArgumentNullException)
            {
                exceptionThrown = true;
            }

            // Assert
            Assert.IsTrue(exceptionThrown);
        }
        public void GraphWithAdjList_AddEdge_NullSource_ThrowsException()
        {
            // Arrange
            var exceptionThrown = false;
            var graph           = new GraphWithAdjList <string, int>();

            // Act
            try
            {
                graph.AddEdge(null, "");
            }
            catch (ArgumentNullException)
            {
                exceptionThrown = true;
            }

            // Assert
            Assert.IsTrue(exceptionThrown);
        }
        public void GraphWithAdjList_AddEdge_DirectedNormalFlow_EdgeAdded()
        {
            // Arrange
            var graph = new GraphWithAdjList <int, int>(true);

            graph.AddVertex(1);
            graph.AddVertex(2);
            var source = graph.GetVertex(1);
            var dest   = graph.GetVertex(2);

            // Act
            graph.AddEdge(1, 2);

            // Assert
            var sourceEdge = source.adjList.FirstOrDefault(e => e.Neighbor.Equals(dest.Data));
            var destEdge   = dest.adjList.FirstOrDefault(e => e.Neighbor.Equals(source.Data));

            Assert.IsNotNull(sourceEdge);
            Assert.IsNull(destEdge);
        }