public void SuggestionsTest()
        {
            //given
            Intelisense   intelisenseTest    = new Intelisense();
            string        textToBeCompletetd = "Sur";
            List <string> expectedResult     = new List <string> {
                "Sursee", "Romanel-sur-Lausanne", "Sur Roche", "Les Geneveys-sur-Coffrane", "Villars-sur-Ollon", "La Roche-sur-Foron", "Belmont-sur-Montreux", "Rabius-Surrein", "Sursee, Bahnhof", "Prélaz-sur-Blonay"
            };
            List <string> resultFromMethod = new List <string>();

            //when
            resultFromMethod = intelisenseTest.GetSuggestions(textToBeCompletetd);

            //then
            CollectionAssert.AreEqual(expectedResult, resultFromMethod);
        }
예제 #2
0
        public void Combobox_KeyUp(object sender, KeyEventArgs e)
        {
            Intelisense intelisense = new Intelisense();

            if (((ComboBox)sender).Text.Length >= 3)
            {
                if (e.KeyCode != Keys.Escape)
                {
                    if (e.KeyCode != Keys.Down && e.KeyCode != Keys.Up && e.KeyCode != Keys.Enter && e.KeyCode != Keys.Left && e.KeyCode != Keys.Right)
                    {
                        intelisense.AutoCompletion((ComboBox)sender);
                    }
                }
                else
                {
                    ((ComboBox)sender).DroppedDown = false;
                }
            }
        }