Example #1
0
 public TweetListener(TwitterAuthConfig authConfig, TweetListenerConfig tweetListenerConfig, IDataForwarderFactory tweetForwarderFactory, ILocationFinder locationFinder)
 {
     _twitterAuthConfig     = authConfig;
     _listenerConfig        = tweetListenerConfig;
     _locationFinder        = locationFinder;
     _tweetForwarderFactory = tweetForwarderFactory;
 }
Example #2
0
        private static async Task MapLocations(string inputFile, string outputFile, string locationsFile)
        {
            Stopwatch       watch          = Stopwatch.StartNew();
            ILocationFinder locationFinder = _locationFinderFactory.GetLocationFinder(inputFile, outputFile, locationsFile);

            Console.WriteLine($"Mapping from {inputFile} to {outputFile} using {locationsFile}");

            await locationFinder.MapLocations().ContinueWith((task) =>
            {
                watch.Stop();
                ConsoleColor originalColor = Console.ForegroundColor;
                if (task.IsCompletedSuccessfully)
                {
                    Console.ForegroundColor = ConsoleColor.DarkGreen;
                    Console.WriteLine($"Mapping successfully completed");
                }
                else
                {
                    Console.WriteLine($"Mapping completed with errors:");
                    Console.ForegroundColor = ConsoleColor.DarkRed;
                    Console.WriteLine(task.Exception.Message);
                }
                Console.ForegroundColor = originalColor;
                Console.WriteLine($"{watch.ElapsedMilliseconds}ms elapsed");
            });
        }
Example #3
0
        public void GetLocationFinder()
        {
            string outputFile = OutputFile();

            ILocationFinder locationFinder = _locationFinderFactory.GetLocationFinder(_inputFile, outputFile, _locationsFile);

            Assert.Equal(locationFinder, _locationFinderFactory.GetLocationFinder(_inputFile, outputFile, _locationsFile));
        }
Example #4
0
 public WeatherService(IWeatherStateService weatherStateService,
                       ILocationFinder locationFinder,
                       IDayTimeServiceFactory dayTimeServiceFactory,
                       ITimeService timeService)
 {
     this._weatherStateService = weatherStateService;
     this._locationFinder      = locationFinder;
     this._dayTimeService      = dayTimeServiceFactory.BuildAndGetInstance();
     this._timeService         = timeService;
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MathRouteController"/> class.
 /// </summary>
 /// <param name="droneFinder">
 /// The drone finder.
 /// </param>
 /// <param name="storeFinder">
 /// The store finder.
 /// </param>
 /// <param name="locationFinder">
 /// The location finder.
 /// </param>
 /// <param name="clientLocations">
 /// The client locations.
 /// </param>
 public MathRouteController(
     IDroneFinder droneFinder,
     IStoreFinder storeFinder,
     ILocationFinder locationFinder,
     IOptions <List <LocationSetting> > clientLocations)
 {
     this.droneService    = droneFinder;
     this.storeFinder     = storeFinder;
     this.locationFinder  = locationFinder;
     this.clientLocations = clientLocations;
 }
Example #6
0
        public async Task MapLocations()
        {
            string          outputFile = OutputFile();
            ILocationFinder finder     = _locationFinderFactory.GetLocationFinder(_inputFile, outputFile, _locationsFile);

            await finder.MapLocations();

            using (StreamReader expectedFileStreamReader = new StreamReader(_expectedOutputFile))
                using (StreamReader outputFileStreamReader = new StreamReader(outputFile))
                {
                    string expectedLine;
                    while ((expectedLine = expectedFileStreamReader.ReadLine()) != null)
                    {
                        Assert.Equal(expectedLine, outputFileStreamReader.ReadLine());
                    }

                    Assert.Null(outputFileStreamReader.ReadLine());
                }
        }
Example #7
0
        public async Task MapLocationsOverridingFilePaths()
        {
            string          initialOutputFile = OutputFile();
            ILocationFinder finder            = _locationFinderFactory.GetLocationFinder(_inputFile, initialOutputFile, _locationsFile);

            string finalOutputFile = OutputFile();
            await finder.MapLocations(_inputFile, finalOutputFile, _locationsFile);

            using (StreamReader expectedFileStreamReader = new StreamReader(_expectedOutputFile))
                using (StreamReader outputFileStreamReader = new StreamReader(finalOutputFile))
                {
                    string expectedLine;
                    while ((expectedLine = expectedFileStreamReader.ReadLine()) != null)
                    {
                        Assert.Equal(expectedLine, outputFileStreamReader.ReadLine());
                    }

                    Assert.Null(outputFileStreamReader.ReadLine());
                }

            Assert.NotEqual(initialOutputFile, finalOutputFile);
            Assert.False(File.Exists(initialOutputFile));
        }
 public WhereIsCommand(ILocationFinder finder, IUrlHelper urlHelper)
 {
     _finder    = finder;
     _urlHelper = urlHelper;
 }