Exemplo n.º 1
0
        public void VertexDescriptor_TryFindEdge_ReturnsFalseForWrongVertex()
        {
            int vertex1 = 10;
            int vertex2 = 20;
            VertexDescriptor <int, string> vertexDescriptor = new VertexDescriptor <int, string>(vertex1);
            EdgeDescriptor <int, string>   edgeDesciptor    = new EdgeDescriptor <int, string>(vertex1, vertex2, "edge");

            vertexDescriptor.AddEdge(edgeDesciptor);

            EdgeDescriptor <int, string> foundEdge;
            bool result = vertexDescriptor.TryFindEdge(vertex2, vertex1, out foundEdge);

            Assert.False(result);
            Assert.Equal(default(EdgeDescriptor <int, string>), foundEdge);
        }
Exemplo n.º 2
0
        public void VertexDescriptor_TryFindEdge_ReturnsEdgeByVertex()
        {
            int vertex1 = 10;
            int vertex2 = 20;
            VertexDescriptor <int, string> vertexDescriptor = new VertexDescriptor <int, string>(vertex1);
            EdgeDescriptor <int, string>   edgeDesciptor    = new EdgeDescriptor <int, string>(vertex1, vertex2, "edge");

            vertexDescriptor.AddEdge(edgeDesciptor);

            EdgeDescriptor <int, string> foundEdge;
            bool result = vertexDescriptor.TryFindEdge(vertex1, vertex2, out foundEdge);

            Assert.True(result);
            Assert.Equal(foundEdge, edgeDesciptor);
        }