public void TestPlanTour_TwoPoints() { // set up var engine = new PlanTourEngine(); engine.LoadGraph(GetPlanTourKmlStream()); // run var planTourParameters = new PlanTourParameters { WaypointIdList = new List <string> { "wheretofly-path-bahnhof-neuhaus", "wheretofly-path-rauhkopf", } }; var tour = engine.PlanTour(planTourParameters); // check Assert.IsTrue(tour.Description.Any(), "description must contain text"); Assert.IsTrue(tour.TotalDuration.TotalMinutes > 0, "total duration must contain value"); Assert.IsTrue(tour.TourEntriesList.Any(), "tour entries list must be filled"); Assert.IsTrue(tour.MapPointList.Any(), "map point list must be filled"); }
/// <summary> /// Adds business logic objects to service collection /// </summary> /// <param name="services">service collection</param> private static void AddLogicServices(IServiceCollection services) { services.AddSingleton <LiveWaypointCacheManager>(); // confiugre and add tour planning engine var logicAssembly = typeof(PlanTourEngine).Assembly; var kmlStream = logicAssembly.GetManifestResourceStream("WhereToFly.WebApi.Logic.Assets.PlanTourPaths.kml"); var engine = new PlanTourEngine(); engine.LoadGraph(kmlStream); services.AddSingleton(engine); }
public void TestLoadingTracksAndWaypoints() { // set up var engine = new PlanTourEngine(); // run var kmlStream = GetPlanTourKmlStream(); var graphLoader = new TourGraphLoader(engine); graphLoader.Load(kmlStream); // check Assert.IsNotNull(engine.FindWaypointInfo("wheretofly-path-rauhkopf"), "waypoint info must be found after loading"); }
public void TestPlanTour_GrandTour() { // set up var engine = new PlanTourEngine(); engine.LoadGraph(GetPlanTourKmlStream()); // run var planTourParameters = new PlanTourParameters { WaypointIdList = new List <string> { "wheretofly-path-bahnhof-neuhaus", "wheretofly-path-spitzingsattel", "wheretofly-path-jagerkamp", ////"wheretofly-path-benzingspitz", "wheretofly-path-tanzeck", "wheretofly-path-aiplspitz", "wheretofly-path-rauhkopf", "wheretofly-path-taubensteinhaus", "wheretofly-path-hochmiesing", "wheretofly-path-rotwand", "wheretofly-path-rotwandhaus", "wheretofly-path-lempersberg", "wheretofly-path-taubenstein", ////"wheretofly-path-albert-link-haus", ////"wheretofly-path-stolzenberg", ////"wheretofly-path-rotkopf", ////"wheretofly-path-rosskopf", ////"wheretofly-path-stuempfling", ////"wheretofly-path-bodenschneid", ////"wheretofly-path-brecherspitz", "wheretofly-path-bahnhof-neuhaus", } }; var tour = engine.PlanTour(planTourParameters); // check Assert.IsTrue(tour.Description.Any(), "description must contain text"); Assert.IsTrue(tour.TotalDuration.TotalMinutes > 0, "total duration must contain value"); Assert.IsTrue(tour.TourEntriesList.Any(), "tour entries list must be filled"); Assert.IsTrue(tour.MapPointList.Any(), "map point list must be filled"); }
public void TestPlanTour_OnePoint() { // set up var engine = new PlanTourEngine(); engine.LoadGraph(GetPlanTourKmlStream()); // run var planTourParameters = new PlanTourParameters { WaypointIdList = new List <string> { "wheretofly-path-bahnhof-neuhaus", } }; Assert.ThrowsException <InvalidOperationException>( () => engine.PlanTour(planTourParameters)); }
/// <summary> /// Creates a new controller to plan tours /// </summary> /// <param name="logger">logger instance to use</param> /// <param name="engine">tour planning engine</param> public PlanTourController(ILogger <PlanTourController> logger, PlanTourEngine engine) { this.logger = logger; this.engine = engine; }