public void TestAPIReturnTemp() { EndProject.WeatherAPI api = new WeatherAPI("Perth, AU"); string apiData = api.GetTemp().ToString(); Assert.AreEqual(true, checkApiData(apiData)); }
public ActionResult test() { WeatherAPI wapi = new WeatherAPI("manisa"); var _Temp = wapi.GetMeteoData(); return(View()); }
public ActionResult Create() { string tomorrowWeather = WeatherAPI.CallAPITomorrowWeather(); ViewBag.weather = tomorrowWeather; return(View()); }
public async void Call_API_And_Return_Weather() { var api = new WeatherAPI(); var weather = await api.GetWeather(); Assert.NotNull(weather); }
public void SetupParameters_emptyList() { var sut = new WeatherAPI(); Assert.That(sut.ZipList.Count, Is.EqualTo(0)); Assert.That(sut.Timers.Count, Is.EqualTo(0)); }
void Start() { weather = WeatherAPI.FindObjectOfType <WeatherAPI>(); windspeed = weather.wind; Force.x = windspeed; Debug.Log(windspeed); }
// Use this for initialization void Start() { //get WeatherAPI weather = WeatherAPI.FindObjectOfType <WeatherAPI>(); Debug.Log("found sky API"); }
void SetupHandler() { BtnReconnect.Click += (a, b) => { SetupMqtt(true); //await TryReconnectAsync(CancellationToken.None); }; BtnRestart.Click += (a, b) => { Windows.System.ShutdownManager.BeginShutdown(Windows.System.ShutdownKind.Restart, TimeSpan.FromSeconds(1)); }; BtnLihat.Click += async(a, b) => { if (string.IsNullOrEmpty(TxtKota.Text)) { // Create the message dialog and set its content var messageDialog = new MessageDialog("Isi nama kotanya, goblok"); // Show the message dialog await messageDialog.ShowAsync(); return; } var temps = await WeatherAPI.GetWeatherInfo(TxtKota.Text); var data = from x in temps.list select new { day = Convert.ToDateTime(x.dt_txt), x.main.temp, x.main.temp_min, x.main.temp_max, x.main.humidity, x.main.pressure }; ListWeather.ItemsSource = data.ToList(); }; BtnPlay.Click += (a, b) => { PlaySound("monster.mp3"); }; BtnD1.Click += ToggleLedClicked; BtnD2.Click += ToggleLedClicked; }
public void CheckWeather() { WeatherAPI DataAPI = new WeatherAPI(City); temp = DataAPI.GetTemp(); Precipmode = DataAPI.GetPrecipMode(); }
public Weather GetWeather() { Weather weather = new WeatherAPI(txtcity.Text).FetchData(); Console.WriteLine(); Console.WriteLine(weather.weather.First().description); return(weather); }
// Use this for initialization // Use this for initialization void Start() { knowsWeather = false; //find the text of this component windText = GameObject.Find("WindText").GetComponent <Text>(); //gets the weather from the API weather = WeatherAPI.FindObjectOfType <WeatherAPI>(); }
public void Start() { _worker = new Thread(DoWorkNew); endFlag = true; _worker.Name = "CE Worker"; weatherAPI = new WeatherAPI(); _worker.Start(); }
private void getWeather(LanguageCode Lang, string City) { try { //Get the data wD = WeatherAPI.GetWeather(Lang, City, celsius); //Set image locations string baseURL = "http://www.google.com"; string iconToday = baseURL + wD.iconTODAY; string icon = baseURL + wD.icon; string iconTOMORROW = baseURL + wD.iconTOMORROW; string iconDAY2 = baseURL + wD.iconDAY2; string iconDAY3 = baseURL + wD.iconDAY3; //Set images icnCurrent.ImageLocation = icon; icnDay2.ImageLocation = iconDAY2; icnDay3.ImageLocation = iconDAY3; icnToday.ImageLocation = iconToday; icnTomorrow.ImageLocation = iconTOMORROW; //Current Conditions lblCity.Text = wD.city; lblCurrentCond.Text = wD.condition; lblCurrentF.Text = temp + ": " + wD.temp_f.ToString() + degree; lblWind.Text = wD.wind_condition; //Day 2's Conditions lblDay2.Text = wD.day_of_weekDAY2; lblDay2Cond.Text = wD.conditionDAY2; lblDay2High.Text = high + ": " + wD.highDAY2.ToString() + degree; lblDay2Low.Text = low + ": " + wD.lowDAY2.ToString() + degree; //Day 3's Conditions lblDay3.Text = wD.day_of_weekDAY3; lblDay3Cond.Text = wD.conditionDAY3; lblDay3High.Text = high + ": " + wD.highDAY3.ToString() + degree; lblDay3Low.Text = low + ": " + wD.lowDAY3.ToString() + degree; //Today's Conditions lblToday.Text = wD.day_of_weekTODAY; lblTodayCond.Text = wD.conditionTODAY; lblTodayHigh.Text = high + ": " + wD.highTODAY.ToString() + degree; lblTodayLow.Text = low + ": " + wD.lowTODAY.ToString() + degree; //Tomorrow's Conditions lblTomorrow.Text = wD.day_of_weekTOMORROW; lblTomorrowCond.Text = wD.conditionTOMORROW; lblTomorrowHigh.Text = high + ": " + wD.highTOMORROW.ToString() + degree; lblTomorrowLow.Text = low + ": " + wD.lowTOMORROW.ToString() + degree; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public JsonResult GetWeather(string destination) { Geolocation geolocation = MapFunctions.Locate(destination); WeatherData todayWeather = new WeatherData(); WeatherAPI weather = new WeatherAPI(geolocation.Latitude, geolocation.Longitude); todayWeather = weather.GetWeather(destination); return(Json(todayWeather, JsonRequestBehavior.AllowGet)); }
public HourlyDisplayData(WeatherAPI wAPI, IpData locationInfo) { // Iterira kroz data niz hourly dela JSON response-a i // prikuplja informacije za <displayHourCount> sat(a). foreach (CurrentWeatherData iter in wAPI.hourly.data) { string hourLabel = GenerateHourLabel(iter.time); displayHours.Add(new HourData(hourLabel, iter.icon, Math.Round(iter.temperature, 0) + "°C", "" + (iter.precipProbability * 100) + " %")); } }
public WeeklyDisplayData(WeatherAPI wAPI, IpData locationInfo) { // Iterira kroz data niz daily dela JSON response-a i // prikuplja informacije za <displayDayCount> dan(a). foreach (DailyWeatherData iter in wAPI.daily.data) { string dayLabel = GenerateDayLabel(iter.time); displayDays.Add(new DayData(dayLabel, iter.icon, "Max: " + Math.Round(iter.temperatureMax, 0) + "°C \nMin: " + Math.Round(iter.temperatureMin, 0) + "°C", "" + (iter.precipProbability * 100) + "%")); } }
//GetWeather method for the veiw that reutrns the users zipcode public JsonResult GetWeather() { var userId = User.Identity.GetUserId(); USER_EXT ext = db.User_ext.SingleOrDefault(u => u.USER_ID == userId); WeatherAPI weather = new WeatherAPI(); //return json of getweatherforcast method //AllowGet return(Json(weather.getWeatherForcast(ext.ZIPCODE), JsonRequestBehavior.AllowGet)); }
public MainWindow(object w, string user) { InitializeComponent(); TestConnection(); callWindow = (Window)w; User = user; cases = repository.GetAllCases(); InvokeUserControls(); weatherAPI = new WeatherAPI(labelWeather); weatherAPI.GetCityNameAsync(); }
public void ZipList_AddNewValues() { var sut = new WeatherAPI(); sut.ZipList.Add(new ZipInformation { ZipCode = "30004", Interval = 6000 }); Assert.That(sut.ZipList, Has.Exactly(1).Matches <ZipInformation>(item => item.ZipCode == "30004" && item.Interval == 6000)); Assert.That(sut.ZipList, Has.Exactly(0).Matches <ZipInformation>(item => item.ZipCode == "30188" && item.Interval == 6000)); }
public ValuesController( IWeatherService weatherService, IMapper mapper, IUserService userService, IConfiguration configuration ) { _weatherService = weatherService; _userService = userService; _mapper = mapper; Configuration = configuration; weatherAPI = new WeatherAPI(); }
public void forecastHumidityTests() { WeatherAPI api = new WeatherAPI(); api.isTest = true; var forecastWeather = api.GetforecastWeather("2163355").Result; Assert.AreEqual(forecastWeather[0][1].MainData.Humidity, 72); Assert.AreEqual(forecastWeather[1][3].MainData.Humidity, 68); Assert.AreEqual(forecastWeather[1][6].MainData.Humidity, 71); Assert.AreEqual(forecastWeather[3][5].MainData.Humidity, 69); Assert.AreEqual(forecastWeather[4][5].MainData.Humidity, 72); }
public ForecastController() { // Dohvatanje forecastApp instance. forecastAppInstance = ForecastApp.GetInstance(); // Weather info. weatherAPI = forecastAppInstance.WeatherDataFromJSON(); // City info. locationInfo = forecastAppInstance.IpAPIData; }
public void forecastCallCounts() { WeatherAPI api = new WeatherAPI(); api.isTest = true; var forecastWeather = api.GetforecastWeather("2163355").Result; Assert.AreEqual(forecastWeather[0].Count, 7); Assert.AreEqual(forecastWeather[1].Count, 8); Assert.AreEqual(forecastWeather[2].Count, 8); Assert.AreEqual(forecastWeather[3].Count, 8); Assert.AreEqual(forecastWeather[4].Count, 9); }
public ActionResult Create(EoDLunchOrderModels Model) { db.Lunch.Add(Model); DateTime Clock = DateTime.Now; Model.DayOfWeek = (int)Clock.DayOfWeek; Model.TomorrowsWeather = WeatherAPI.CallAPITomorrowWeather(); Model.Date = DateTime.Now.ToString("dd/MM/yyyy"); db.SaveChanges(); return(RedirectToAction("Bingus", "EoDLunchOrderController")); }
public void forecastWeatherTypeTests() { WeatherAPI api = new WeatherAPI(); api.isTest = true; var forecastWeather = api.GetforecastWeather("2163355").Result; Assert.AreEqual(forecastWeather[0][1].WeatherInfo[0].WeatherType, "Rain"); Assert.AreEqual(forecastWeather[0][4].WeatherInfo[0].WeatherType, "Rain"); Assert.AreEqual(forecastWeather[2][2].WeatherInfo[0].WeatherType, "Rain"); Assert.AreEqual(forecastWeather[2][7].WeatherInfo[0].WeatherType, "Rain"); Assert.AreEqual(forecastWeather[4][2].WeatherInfo[0].WeatherType, "Clear"); Assert.AreEqual(forecastWeather[4][8].WeatherInfo[0].WeatherType, "Clouds"); }
public void forecastRainfallTests() { WeatherAPI api = new WeatherAPI(); api.isTest = true; var forecastWeather = api.GetforecastWeather("2163355").Result; Assert.AreEqual(forecastWeather[0][1].RainFall.RainVolumeOverPast3Hours, 1.13f); Assert.AreEqual(forecastWeather[0][4].RainFall.RainVolumeOverPast3Hours, 0.13f); Assert.AreEqual(forecastWeather[2][2].RainFall.RainVolumeOverPast3Hours, 0.19f); Assert.AreEqual(forecastWeather[2][7].RainFall.RainVolumeOverPast3Hours, 0.5f); Assert.AreEqual(forecastWeather[4][2].RainFall, null); Assert.AreEqual(forecastWeather[4][8].RainFall, null); }
public IActionResult TestData() { WeatherAPI api = new WeatherAPI(); Task <WeatherResponse> apitask = Task.Factory.StartNew(() => api.GetWeatherData()); apitask.Wait(); WeatherResponse weatherdata = apitask.Result; return(RedirectToAction("Widget", weatherdata)); }
// Start is called before the first frame update void Start() { api = api.gameObject.GetComponent <WeatherAPI>(); audioSource = this.GetComponentInParent <AudioSource>(); for (int i = 0; i < weatherObjects.Length; i++) { weatherObjects[i].SetActive(false); } for (int i = 0; i < particles.Length; i++) { particles[i].SetActive(false); } }
public void forecastTempTests() { WeatherAPI api = new WeatherAPI(); api.isTest = true; var forecastWeather = api.GetforecastWeather("2163355").Result; Assert.AreEqual(forecastWeather[0][0].MainData.Temperature, 9); Assert.AreEqual(forecastWeather[0][0].MainData.Temperature, 9); Assert.AreEqual(forecastWeather[2][6].MainData.Temperature, 11); Assert.AreEqual(forecastWeather[2][6].MainData.Temperature, 11); Assert.AreEqual(forecastWeather[1][3].MainData.Temperature, 10); Assert.AreEqual(forecastWeather[3][7].MainData.Temperature, 12); Assert.AreEqual(forecastWeather[4][3].MainData.Temperature, 12); }
public async Task GetWeatherFor(string city) { var wapi = new WeatherAPI(); var results = await wapi.Get(city); var sb = new StringBuilder(4); foreach (var item in results.list.Where(i => i.Date > DateTime.Now).Take(3)) { sb.AppendLine(item.ToString()); } Clients.Caller.addBotWeatherToPage(sb.ToString()); }