コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: xanthe/weather-net
        public void GetFiveDaysForecastByCityCoordinatesTest()
        {
            //Does not exist
            var result = FiveDaysForecast.GetByCoordinates(-1984453.363665, -1984453.363665);

            Assert.IsFalse(result.Success);
            Assert.IsNull(result.Items);

            //Exist
            result = FiveDaysForecast.GetByCoordinates(53.363665, -6.255541, "se", "imperial");
            Assert.IsTrue(result.Success);
            Assert.IsNotNull(result.Items);
            Assert.IsTrue(result.Items.Count > 0);
            Assert.IsNotNull(result.Items[0]);
        }
コード例 #2
0
        public async Task WeatherForecast(Location location)
        {
            var weather  = CurrentWeather.GetByCityName("Kiev", "Ukrain");
            var forecast = FiveDaysForecast.GetByCoordinates(location.Latitude, location.Longitude);


            await TelegramBotClient.SendTextMessageAsync(
                chatId : Update.Message.Chat.Id,
                text : $"{weather.Item.Temp}"
                );

            var weather1 = CurrentWeather.GetByCoordinates(location.Latitude, location.Longitude);

            await TelegramBotClient.SendTextMessageAsync(
                chatId : Update.Message.Chat.Id,
                text : $"{weather1.Item.Temp}"
                );
        }