private void FireTest(IMainTestControl mainTestControl)
        {
            if (TestPending)
            {
                throw new TestAlreadyRunningException();
            }

            TestPending            = true;
            cancelationTokenSource = new CancellationTokenSource();
            mainTestControl.SetStatus(TestStatus.Pending);

            // This is intended, it should run in background
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            Task.Run(() =>
            {
                var start = DateTime.Now;
                mainTestControl.UpdateTimer(TimeSpan.Zero);
                var task = _connectionStringTester.Test(
                    _connectionStringCleaner.Clean(mainTestControl.ConnectionString));
                while (!task.IsCompleted)
                {
                    if (cancelationTokenSource.Token.IsCancellationRequested)
                    {
                        mainTestControl.SetStatus(TestStatus.Cancelled);

                        mainTestControl.DisplayMessage("Cancelled", false);
                        TestPending = false;
                        return;
                    }
                    mainTestControl.UpdateTimer(DateTime.Now - start);
                }

                mainTestControl.UpdateTimer(DateTime.Now - start);
                var result = task.Result;

                mainTestControl.SetStatus(result.Success ? TestStatus.Succeeded : TestStatus.Failed);

                mainTestControl.DisplayMessage(result.Message, result.Success);
                TestPending = false;
            });
#pragma warning restore CS4014

            mainTestControl.RefreshAutoComplete();
        }
 private void CopyToClipboard(IMainTestControl mainTestControl)
 {
     Clipboard.SetText(mainTestControl.Message);
 }