Ejemplo n.º 1
0
        public void GetEdgeInfo()
        {
            var vertex1 = new TestVertex("1");
            var vertex2 = new TestVertex("2");
            var edge    = new Edge <TestVertex>(vertex1, vertex2);

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

            Assert.IsNull(algorithm1.GetEdgeInfo(edge));

            var algorithm2 = new TestDefaultSimpleParameterizedLayoutAlgorithm(graph);

            Assert.IsNull(algorithm2.GetEdgeInfo(edge));

            var algorithm3 = new TestComplexParameterizedLayoutAlgorithm(graph);

            Assert.IsNull(algorithm3.GetEdgeInfo(edge));

            graph.AddVerticesAndEdge(edge);
            Assert.IsNull(algorithm3.GetEdgeInfo(edge));

            const double edgeInfo = 1.2;

            algorithm3.EdgesInfos.Add(edge, edgeInfo);
            Assert.AreEqual(edgeInfo, algorithm3.GetEdgeInfo(edge));

            algorithm3.EdgesInfos.Remove(edge);
            Assert.IsNull(algorithm3.GetEdgeInfo(edge));
        }
Ejemplo n.º 2
0
        public void GetEdgeInfo_Throws()
        {
            // ReSharper disable ReturnValueOfPureMethodIsNotUsed
            // ReSharper disable AssignNullToNotNullAttribute
            var graph      = new AdjacencyGraph <TestVertex, Edge <TestVertex> >();
            var algorithm1 = new TestSimpleParameterizedLayoutAlgorithm(graph);

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

            var algorithm2 = new TestDefaultSimpleParameterizedLayoutAlgorithm(graph);

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

            var algorithm3 = new TestComplexParameterizedLayoutAlgorithm(graph);

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