public void RoutingWithAnnotationTrue_ShouldReturnStatusOkWithValidAnnotations() { using (Osrm sut = new Osrm(_orlandoEngineConfig.EngineConfig)) { RouteResult routeResult; var result = sut.Route(new RouteParameters() { Coordinates = new List <Coordinate>() { new Coordinate(28.479065, -81.463945), new Coordinate(28.598181, -81.207633) }, Annotations = true, }, out routeResult); var annotations = routeResult.Routes.SelectMany(x => x.Legs).Select(y => y.Annotation).Where(x => x != null); var enumerable = annotations as IList <Annotation> ?? annotations.ToList(); var distances = enumerable.SelectMany(x => x.Distance); var nodes = enumerable.SelectMany(x => x.Nodes); Assert.Equal(result, Status.Ok); AssertValidRoute(routeResult); Assert.NotEmpty(distances); Assert.NotEmpty(nodes); } }
public void RoutingWithInvalidCoordinate_ShouldReturnStatusError() { using (Osrm sut = new Osrm(_orlandoEngineConfig.EngineConfig)) { RouteResult routeResults; // No coordinate specified var result = sut.Route(new RouteParameters(), out routeResults); Assert.Equal(result, Status.Error); } }
public void RoutingWithValidStartEndCoordinate_ShouldReturnStatusOk() { using (Osrm sut = new Osrm(_orlandoEngineConfig.EngineConfig)) { IEnumerable <RouteResult> routeResults; var result = sut.Route(new RouteParameters() { Coordinates = new List <Coordinate>() { new Coordinate(28.479065, -81.463945), new Coordinate(28.598181, -81.207633) }, }, out routeResults); Assert.Equal(result, Status.Ok); } }
public void RoutingWithValidStartEndCoordinate_ShouldReturnStatusOk() { using (Osrm sut = new Osrm(_orlandoEngineConfigMld.EngineConfig)) { RouteResult routeResult; var result = sut.Route(new RouteParameters() { Coordinates = new List <Coordinate>() { new Coordinate(28.479065, -81.463945), new Coordinate(28.598181, -81.207633) }, }, out routeResult); Assert.Equal(Status.Ok, result); OsrmTestAssert.AssertValidRoute(routeResult); } }
//[Fact] public void RoutingWithValidStartEndCoordinate_ShouldReturnStatusOk() { using (var sut = new Osrm(_config.EngineConfig)) { RouteResult routeResult; var result = sut.Route(new RouteParameters { Coordinates = new List <Coordinate> { new Coordinate(48.829717, 2.349566), new Coordinate(48.629575, 2.472986) } }, out routeResult); Assert.Equal(Status.Ok, result); OsrmTestAssert.AssertValidRoute(routeResult); } }
public void RoutingWithStepsTrue_ShouldReturnValidSteps() { using (Osrm sut = new Osrm(_orlandoEngineConfig.EngineConfig)) { IEnumerable <RouteResult> routeResults; var result = sut.Route(new RouteParameters() { Coordinates = new List <Coordinate>() { new Coordinate(28.479065, -81.463945), new Coordinate(28.598181, -81.207633) }, Steps = true, }, out routeResults); var steps = routeResults.SelectMany(x => x.Legs).Select(x => x.Steps); Assert.NotEmpty(steps); } }
public void RoutingWithStepsTrue_ShouldReturnEmpty() { using (Osrm sut = new Osrm(_orlandoEngineConfig.EngineConfig)) { RouteResult routeResult; var result = sut.Route(new RouteParameters() { Coordinates = new List <Coordinate>() { new Coordinate(28.479065, -81.463945), new Coordinate(28.598181, -81.207633) }, Steps = false, }, out routeResult); Assert.Equal(result, Status.Ok); AssertValidRoute(routeResult); var steps = routeResult.Routes.SelectMany(x => x.Legs).SelectMany(x => x.Steps); Assert.Empty(steps); } }
public void RoutingWithAnnotationFalse_ShouldReturnStatusOkWithEmptyAnnotations() { using (Osrm sut = new Osrm(_orlandoEngineConfig.EngineConfig)) { IEnumerable <RouteResult> routeResults; var result = sut.Route(new RouteParameters() { Coordinates = new List <Coordinate>() { new Coordinate(28.479065, -81.463945), new Coordinate(28.598181, -81.207633) }, Annotations = true, }, out routeResults); var annotations = routeResults.SelectMany(x => x.Legs).Select(y => y.Annotation).Where(x => x != null); Assert.Equal(result, Status.Ok); Assert.NotEmpty(annotations); } }
public void RoutingWithAnnotationFalse_ShouldReturnStatusOkWithEmptyAnnotations() { using (Osrm sut = new Osrm(_orlandoEngineConfigMld.EngineConfig)) { RouteResult routeResult; var result = sut.Route(new RouteParameters() { Coordinates = new List <Coordinate>() { new Coordinate(28.479065, -81.463945), new Coordinate(28.598181, -81.207633) }, Annotations = AnnotationsType.All, }, out routeResult); var annotations = routeResult.Routes.SelectMany(x => x.Legs).Select(y => y.Annotation).Where(x => x != null); Assert.Equal(Status.Ok, result); OsrmTestAssert.AssertValidRoute(routeResult); Assert.NotEmpty(annotations); } }
public void RoutingWithMoreAlternateAllowed_ShouldFailWithTooBigCode() { using (Osrm sut = new Osrm(_orlandoEngineConfigMld.EngineConfig)) { RouteResult routeResult; var result = sut.Route(new RouteParameters() { Coordinates = new List <Coordinate>() { new Coordinate(28.479065, -81.463945), new Coordinate(28.598181, -81.207633), new Coordinate(28.598181, -81.207633), new Coordinate(28.598181, -81.207633), }, Steps = false, NumberOfAlternatives = 4 }, out routeResult); Assert.Equal(Status.Error, result); Assert.Equal("TooBig", routeResult.Code); } }