Example #1
0
        public void GetVertexInfo()
        {
            var vertex = new TestVertex("1");

            var graph      = new AdjacencyGraph <TestVertex, Edge <TestVertex> >();
            var algorithm1 = new TestSimpleParameterizedLayoutAlgorithm(graph);

            Assert.IsNull(algorithm1.GetVertexInfo(vertex));

            var algorithm2 = new TestDefaultSimpleParameterizedLayoutAlgorithm(graph);

            Assert.IsNull(algorithm2.GetVertexInfo(vertex));

            var algorithm3 = new TestComplexParameterizedLayoutAlgorithm(graph);

            Assert.IsNull(algorithm3.GetVertexInfo(vertex));

            graph.AddVertex(vertex);
            Assert.IsNull(algorithm3.GetVertexInfo(vertex));

            const int vertexInfo = 1;

            algorithm3.VerticesInfos.Add(vertex, vertexInfo);
            Assert.AreEqual(vertexInfo, algorithm3.GetVertexInfo(vertex));

            algorithm3.VerticesInfos.Remove(vertex);
            Assert.IsNull(algorithm3.GetVertexInfo(vertex));
        }
Example #2
0
        public void GetVertexInfo_Throws()
        {
            // ReSharper disable ReturnValueOfPureMethodIsNotUsed
            // ReSharper disable AssignNullToNotNullAttribute
            var graph      = new AdjacencyGraph <TestVertex, Edge <TestVertex> >();
            var algorithm1 = new TestSimpleParameterizedLayoutAlgorithm(graph);

            Assert.Throws <ArgumentNullException>(() => algorithm1.GetVertexInfo(null));

            var algorithm2 = new TestDefaultSimpleParameterizedLayoutAlgorithm(graph);

            Assert.Throws <ArgumentNullException>(() => algorithm2.GetVertexInfo(null));

            var algorithm3 = new TestComplexParameterizedLayoutAlgorithm(graph);

            Assert.Throws <ArgumentNullException>(() => algorithm3.GetVertexInfo(null));
            // ReSharper restore AssignNullToNotNullAttribute
            // ReSharper restore ReturnValueOfPureMethodIsNotUsed
        }