public static void Main(string[] args) { var options = new Options(); var parser = new CommandLine.Parser(); if (parser.ParseArguments(args, options)) { var configManager = new CliConfigManager(); Config = configManager.GetConfig(); var configEntry = Config.Areas.FirstOrDefault(x => x.Id.Equals(options.ServiceEndpoint)); if (configEntry == null) { Console.WriteLine("Invalid endpoint!"); return; } var service = new Bus13RouteDataService(configEntry.Endpoint, configEntry.Id); if (options.List) { ListVehicles(service); } if (options.Trace) { if (string.IsNullOrEmpty(options.VehicleId)) { Console.WriteLine("Vehicle id must be supplied!"); return; } if (!string.IsNullOrEmpty(options.OutputDir) && !Directory.Exists(options.OutputDir)) { Console.WriteLine("Directory {0} doesn't exist!", options.OutputDir); return; } IVehicleTraceOutputWriter outputWriter = null; if (string.IsNullOrEmpty(options.OutputType) || string.Equals("kml", options.OutputType, StringComparison.InvariantCultureIgnoreCase)) { outputWriter = new KmlOutputWriter(GetOutputDir(options)); } if (string.Equals("json", options.OutputType, StringComparison.InvariantCultureIgnoreCase)) { outputWriter = new JsonOutputWriter(GetOutputDir(options)); } if (outputWriter == null) { outputWriter = new KmlOutputWriter(GetOutputDir(options)); } Trace(service, options.VehicleId, outputWriter); Console.ReadKey(); } } }
public async void CanGetCheboksaryVehicleLocations() { var cheboksary = _config.Areas.FirstOrDefault(x => x.Id.Equals("cheboksary")); var service = new Bus13RouteDataService( cheboksary.Endpoint, cheboksary.DataServiceCode, cheboksary.DataServiceInfoParam); var routes = await service.GetRoutesAsync(); var vehicles = await service.GetVehicleLocationsAsync(routes, GeoRect.EarthWide, 0); Assert.IsTrue(vehicles.Updates.Count() > 0); }
public async void CanGetRoutes() { foreach (var area in _config.Areas) { Console.WriteLine("Testing against {0}", area.Id); var service = new Bus13RouteDataService( area.Endpoint, area.DataServiceCode, area.DataServiceInfoParam); var routes = await service.GetRoutesAsync(); Assert.IsTrue(routes.Count() > 0); } }