Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            while (true)
            {
                try
                {
                    panel2.Controls.RemoveAt(0);
                }
                catch (Exception exce)
                {
                    break;
                }
            }

            string searchString = textBox1.Text;

            int count = 0;

            foreach (var item in GetWeather.Search(searchString))
            {
                count++;
                Button newButton = new Button();
                newButton.Location = new Point(13, 25 * count + 13);
                newButton.Text     = item.title;
                newButton.Click   += (s, EventArgs) => { dynamicButton_click(s, EventArgs, item.woeid); };

                panel2.Controls.Add(newButton);
                if (count == 5)
                {
                    break;
                }
            }
        }
Ejemplo n.º 2
0
 public void UrlInjectionSearch()
 {
     //Arange
     string input = "buc/ro";
     //Act
     List <Search> searchResult = GetWeather.Search(input);
     //Assert
 }
Ejemplo n.º 3
0
 public void gibberishSearch()
 {
     //Arange
     string input = "aslrgo23q590q3ngbg";
     //Act
     List <Search> searchResult = GetWeather.Search(input);
     //Assert
 }
Ejemplo n.º 4
0
 public void emptySearch()
 {
     //Arange
     string input = "";
     //Act
     List <Search> searchResult = GetWeather.Search(input);
     //Assert
 }
Ejemplo n.º 5
0
        public void SearchCity()
        {
            //Arange
            string input = "yo";
            //Act
            List <Search> searchResult = GetWeather.Search(input);

            //Assert
            Assert.AreEqual("Yokohama", searchResult[2].title);
            Assert.AreEqual("York", searchResult[6].title);
            Assert.AreEqual(7, searchResult.Count);
        }
Ejemplo n.º 6
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);
        }