static async Task Main(string[] args)
        {
            var dbManager   = new SqliteDbManager();
            var statService = new ConcreteStatService();

            List <Tuple <string, int> > serviceResults = await statService.GetCountryPopulationsAsync();

            List <Tuple <string, int> > dbResults = await dbManager.GetCountryPopulationsAsync();

            List <Tuple <string, int> > results = AccumulateResults.Aggregate(dbResults, serviceResults);

            PrintResults.Print(results);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Started");
            Console.WriteLine("Getting DB Connection...");

            // Instantiate new list of tuples to house the results from sql query
            List <Tuple <string, int> > baseCountryPopulation = GetCountryPopulationsFromSQLAsync().Result;

            // Retrive other tuple list
            ConcreteStatService         concreteStatService      = new ConcreteStatService();
            List <Tuple <string, int> > countryPopulationFromApi = concreteStatService.GetCountryPopulationsAsync().Result;

            // Merge the tuples with the sql data as the base
            baseCountryPopulation = MergeTupleLists(baseCountryPopulation, countryPopulationFromApi).Result;

            var sorted = baseCountryPopulation.OrderBy(t => t.Item1).ToList();

            foreach (var tuple in sorted)
            {
                Console.WriteLine("{0} - {1}", tuple.Item1, tuple.Item2);
            }
            Console.ReadLine();
        }