public virtual void FindPath_EndPointsDoesntBelongToGraph_TrowsArgumentException() { var graph = testAssemble.AssembleGraph(0, Constants.Width, Constants.Length); var endPoints = new TestEndPoints(); var algorithm = CreateAlgorithm(graph, endPoints); Assert.Throws <ArgumentException>(() => algorithm.FindPath()); }
public void Ensure_Test_Endpoint_Usage() { var endpoints = new TestEndPoints(); Assert.AreEqual( "https://api.bol.com/retailer-demo/", endpoints.BaseUriApiCalls ); }
public void FindPath_GraphsWithoutObstacles_ReturnsNotEmptyPath(int[] dimensionSizes) { var graph = testGraphAssemble.AssembleGraph(0, dimensionSizes); var endPoints = new TestEndPoints(graph.Vertices.First(), graph.Vertices.Last()); var algorithm = CreateAlgorithm(graph, endPoints); var graphPath = algorithm.FindPath(); Assert.IsTrue(graphPath.PathLength > 0); Assert.IsTrue(graphPath.PathCost > 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); }
public virtual void FindPath_EndpointsBelongToGraph_ReturnsShortestPath() { var graph = testgraph2DAssemble.AssembleGraph(); var endPoints = new TestEndPoints(graph.Vertices.First(), graph.Vertices.Last()); var algorithm = CreateAlgorithm(graph, endPoints); var graphPath = algorithm.FindPath(); Assert.AreEqual(GetExpectedLength(), graphPath.PathLength); Assert.AreEqual(GetExpectedCost(), graphPath.PathCost); }
public virtual void FindPath_EndpointsBelongToGraph_ReturnsShortestPath() { int expectedLength = GetExpectedLength(); int expectedCost = GetExpectedCost(); var graph = testAssemble.AssembleGraph(0, Constants.Width, Constants.Length); var start = graph.Vertices.First(); var end = graph.Vertices.Last(); var endPoints = new TestEndPoints(start, end); var algorithm = CreateAlgorithm(graph, endPoints); var graphPath = algorithm.FindPath(); var realLength = graphPath.Path.Count(); var realCost = graphPath.PathCost; Assert.AreEqual(realLength, expectedLength); Assert.AreEqual(realCost, expectedCost); }