示例#1
0
        public void SetNeighbours_DoesntThrow()
        {
            var graph  = new NullGraph();
            var vertex = (NullVertex)graph.Vertices.First();

            Assert.DoesNotThrow(() => vertex.SetNeighbours(graph));
        }
示例#2
0
        public void SetNeighbours_NullVertexFromOtherNullGraph_ThrowsArgumentException()
        {
            var graph      = new NullGraph();
            var otherGraph = new NullGraph();
            var vertex     = graph.Vertices.First();

            Assert.Throws <ArgumentException>(() => vertex.SetNeighbours(otherGraph));
        }
示例#3
0
        public void CanBeNeighbours_VerticesBelongToGraph_ReturnsFalse()
        {
            var graph = new NullGraph();

            NullVertex candidate = (NullVertex)graph.Vertices.Last();
            NullVertex vertex    = (NullVertex)graph.Vertices.First();

            Assert.IsFalse(graph.CanBeNeighbours(candidate, vertex));
        }
示例#4
0
        public void AreNeighbours_VerticesDoesntBelongToGraph_ReturnFalse()
        {
            var graph = new NullGraph();

            NullVertex candidate = new NullVertex();
            NullVertex vertex    = (NullVertex)graph.Vertices.First();

            Assert.IsFalse(graph.AreNeighbours(candidate, vertex));
        }
示例#5
0
        public void AreNeighbours_DoesnotThrow()
        {
            NullGraph graph = new NullGraph();

            NullVertex candidate = new NullVertex();
            NullVertex vertex    = (NullVertex)graph.Vertices.First();

            Assert.DoesNotThrow(() => graph.AreNeighbours(candidate, vertex));
        }
示例#6
0
        public void ToCoordinates_NullGraph_IndexIsInRange_ReturnEmptyCoordinates()
        {
            var       expectedCoordinates = new int[] { };
            NullGraph graph = new NullGraph();
            int       index = 0;

            var coordinates = graph.ToCoordinates(index);

            Assert.IsTrue(coordinates.SequenceEqual(expectedCoordinates));
        }
示例#7
0
        public void SetNeighbours_NullVertex_NullGraph_ReturnsRightNumberOfNeighbours()
        {
            const int  expectedNumberOfNeighbours = 1;
            var        graph  = new NullGraph();
            NullVertex vertex = (NullVertex)graph.Vertices.First();

            vertex.SetNeighbours(graph);

            Assert.AreEqual(expectedNumberOfNeighbours, vertex.Neighbours.Count);
        }
示例#8
0
        public virtual void FindPath_NullGraph_ReturnsEmptyPath()
        {
            var graph     = new NullGraph();
            var endPoints = new TestEndPoints(graph.Vertices.First(), graph.Vertices.Last());
            var algorithm = CreateAlgorithm(graph, endPoints);

            var graphPath = algorithm.FindPath();

            Assert.AreEqual(default(int), graphPath.PathLength);
            Assert.AreEqual(default(double), graphPath.PathCost);
        }
示例#9
0
        public void ConnectVertices_DoesntThrow()
        {
            var graph = new NullGraph();

            Assert.DoesNotThrow(() => graph.ConnectVertices());
        }
示例#10
0
        public void ForEach_DoesntThrow()
        {
            var graph = new NullGraph();

            Assert.DoesNotThrow(() => graph.ForEach(vertex => vertex.GetHashCode()));
        }
示例#11
0
        public void ToUnweighted_DoesntThrow()
        {
            var graph = new NullGraph();

            Assert.DoesNotThrow(() => graph.ToUnweighted());
        }
示例#12
0
        public void Refresh_DoesnotThrows()
        {
            var graph = new NullGraph();

            Assert.DoesNotThrow(() => graph.Refresh());
        }