public void SetNeighbours_DoesntThrow() { var graph = new NullGraph(); var vertex = (NullVertex)graph.Vertices.First(); Assert.DoesNotThrow(() => vertex.SetNeighbours(graph)); }
public void SetNeighbours_NullVertexFromOtherNullGraph_ThrowsArgumentException() { var graph = new NullGraph(); var otherGraph = new NullGraph(); var vertex = graph.Vertices.First(); Assert.Throws <ArgumentException>(() => vertex.SetNeighbours(otherGraph)); }
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)); }
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)); }
public void AreNeighbours_DoesnotThrow() { NullGraph graph = new NullGraph(); NullVertex candidate = new NullVertex(); NullVertex vertex = (NullVertex)graph.Vertices.First(); Assert.DoesNotThrow(() => graph.AreNeighbours(candidate, vertex)); }
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)); }
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); }
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); }
public void ConnectVertices_DoesntThrow() { var graph = new NullGraph(); Assert.DoesNotThrow(() => graph.ConnectVertices()); }
public void ForEach_DoesntThrow() { var graph = new NullGraph(); Assert.DoesNotThrow(() => graph.ForEach(vertex => vertex.GetHashCode())); }
public void ToUnweighted_DoesntThrow() { var graph = new NullGraph(); Assert.DoesNotThrow(() => graph.ToUnweighted()); }
public void Refresh_DoesnotThrows() { var graph = new NullGraph(); Assert.DoesNotThrow(() => graph.Refresh()); }