public void SearchFormatsServerNameProperly()
 {
     var searcher = new ServerInstancesSearcher(() => CreateWithItem(string.Empty));
     Task<List<string>> foundTask = searcher.FindSqlServerInstancesAsync();
     Task assertTask = foundTask.ContinueWith(AssertServerNameFormatsProperly);
     assertTask.Wait();
 }
 public void SearchNeverReturnsNull()
 {
     var searcher = new ServerInstancesSearcher(CreateEmptyTable);
     Task<List<string>> foundTask = searcher.FindSqlServerInstancesAsync();
     var assertTask = foundTask.ContinueWith(t => Assert.IsNotNull(t.Result, "Search engine should never return null"));
     assertTask.Wait();
 }
 public void SearchAcceptsNull()
 {
     var searcher = new ServerInstancesSearcher(() => null);
     Task<List<string>> foundTask = searcher.FindSqlServerInstancesAsync();
     var assertTask = foundTask.ContinueWith(t => Assert.IsNotNull(t.Result, "Search engine should accept null table"));
     assertTask.Wait();
 }
        private void SearchServersButtonClick(object sender, EventArgs e)
        {
            this.queryLabel.Visible = true;
            var searcher = new ServerInstancesSearcher();
            var t = searcher.FindSqlServerInstancesAsync();

            t.ContinueWith((antecedent) =>
                {
                    this.FillServersComboboxItems(antecedent.Result);
                    this.queryLabel.Visible = false;
                }, TaskScheduler.FromCurrentSynchronizationContext());
        }