Ejemplo n.º 1
0
        private void dynamicButton_click(object sender, EventArgs e, int par = 0)
        {
            var res = GetWeather.GetLocation(par);

            label1.Text = res.parent.title;
            label2.Text = res.title;
            label3.Text = res.location_type;
            int count = 0;

            while (true)
            {
                try
                {
                    panel1.Controls.RemoveAt(0);
                }
                catch (Exception exce)
                {
                    break;
                }
            }
            foreach (var location in res.consolidated_weather)
            {
                var lb = new Label();
                lb.Width    = 300;
                lb.Text     = $"{location.applicable_date}:Minima:{location.min_temp},Maxima: {location.max_temp}";
                lb.Location = new Point(13, 25 * count + 13);
                count++;
                panel1.Controls.Add(lb);
            }
        }
Ejemplo n.º 2
0
 public void invalidWoeid()
 {
     //Arange
     string input = "Bucharest";
     //Act
     RootobjectLocation location = GetWeather.GetLocation(99999999);
     //Assert
 }
Ejemplo n.º 3
0
        public void CheckDeserialization()
        {
            //Arange
            string input = "Bucharest";
            //Act
            Search             searchResult = GetWeather.Search(input)[0];
            RootobjectLocation location     = GetWeather.GetLocation(searchResult.woeid);

            //Assert
            Assert.AreEqual("Romania", location.parent.title);
            Assert.AreEqual("Bucharest", location.title);
        }