static async Task CalculateResults()
        {
            ServiceProvider provider = ConfigureServices();

            ILocationServiceAdapter locationAdapter = provider.GetService <ILocationServiceAdapter>();
            IGeoLocationService     geoService      = provider.GetService <IGeoLocationService>();

            IUser[] users = await locationAdapter.GetUsers("https://jsonplaceholder.typicode.com/users");

            GeoLocationResult result = geoService.GetFarthestUsers(users);

            Console.WriteLine($"Farthest distance is: {result.Distance} km");

            Console.WriteLine();
            result.UserOne.PrintUser();

            Console.WriteLine();
            result.UserTwo.PrintUser();

            PrintResultsToDisk(result);
        }
Exemplo n.º 2
0
 public LocationsController(ILocationServiceAdapter service)
 {
     _service = service;
 }