Exemple #1
0
        public async Task Can_Retrieve_Weather_Data()
        {
            //Arrange
            string        city   = "Rzeszow";
            WeatherEntity entity = null;

            //Act
            entity = await _dataAccesService.RetrieveWeatherDataByCityAsync(city);

            //Assert
            Assert.NotNull(entity);
        }
Exemple #2
0
        public async void ShowWeatherData(string city)
        {
            var entity = await _dataRepo.RetrieveWeatherDataByCityAsync(city);

            if (entity != null && !String.IsNullOrWhiteSpace(entity.Name))
            {
                Console.WriteLine("");
                Console.WriteLine("");
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("=================== Weather Info ===================");
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("");
                Console.WriteLine($"Date: {DateTime.Now}");
                Console.WriteLine($"City: {entity.Name}");
                Console.WriteLine($"The weather outside is {entity.Weather[0].Main}");
                Console.WriteLine($"Temperature is {entity.Main.Temp} C degrees");
                Console.WriteLine($"The pressure is {entity.Main.Pressure} hPa");
                Console.WriteLine("");
                Console.WriteLine("====================================================");
            }
        }