SetConnectionInProgress() private method

private SetConnectionInProgress ( IProgressEvents progressEvents ) : void
progressEvents IProgressEvents
return void
        public void ConnectionController_ShowNuGetWarning()
        {
            // Setup
            ConnectionController testSubject = new ConnectionController(this.host, this.connectionProvider, this.connectionWorkflow);
            this.host.SetActiveSection(ConfigurableSectionController.CreateDefault());
            ConfigurableUserNotification notifications = (ConfigurableUserNotification)this.host.ActiveSection.UserNotifications;
            this.connectionProvider.ConnectionInformationToReturn = null;
            var progressEvents = new ConfigurableProgressEvents();
            
            // Case 1: do NOT show
            // Setup
            this.settings.ShowServerNuGetTrustWarning = false;

            // Act
            testSubject.SetConnectionInProgress(progressEvents);
            progressEvents.SimulateFinished(ProgressControllerResult.Succeeded);

            // Verify
            notifications.AssertNoNotification(NotificationIds.WarnServerTrustId);

            // Case 2: show, but cancelled
            // Setup
            this.settings.ShowServerNuGetTrustWarning = false;

            // Act
            testSubject.SetConnectionInProgress(progressEvents);
            progressEvents.SimulateFinished(ProgressControllerResult.Cancelled);

            // Verify
            notifications.AssertNoNotification(NotificationIds.WarnServerTrustId);


            // Case 3: show, but failed
            // Setup
            this.settings.ShowServerNuGetTrustWarning = false;

            // Act
            testSubject.SetConnectionInProgress(progressEvents);
            progressEvents.SimulateFinished(ProgressControllerResult.Failed);

            // Verify
            notifications.AssertNoNotification(NotificationIds.WarnServerTrustId);

            // Test Case 4: show, succeeded
            // Setup
            this.settings.ShowServerNuGetTrustWarning = true;

            // Act
            testSubject.SetConnectionInProgress(progressEvents);
            progressEvents.SimulateFinished(ProgressControllerResult.Succeeded);

            // Verify
            notifications.AssertNotification(NotificationIds.WarnServerTrustId, Strings.ServerNuGetTrustWarningMessage);
        }
        public void ConnectionController_SetConnectionInProgress()
        {
            // Setup
            ConnectionController testSubject = new ConnectionController(this.host, this.connectionProvider, this.connectionWorkflow);
            this.connectionProvider.ConnectionInformationToReturn = null;
            var progressEvents = new ConfigurableProgressEvents();
            var connectionInfo = new ConnectionInformation(new Uri("http://refreshConnection"));

            // Sanity
            Assert.IsTrue(testSubject.ConnectCommand.CanExecute());
            Assert.IsTrue(testSubject.RefreshCommand.CanExecute(connectionInfo));

            foreach (var controllerResult in (ProgressControllerResult[])Enum.GetValues(typeof(ProgressControllerResult)))
            {
                this.outputWindowPane.Reset();

                // Act - disable
                testSubject.SetConnectionInProgress(progressEvents);

                // Verify 
                Assert.IsFalse(testSubject.ConnectCommand.CanExecute(), "Connection is in progress so should not be enabled");
                Assert.IsFalse(testSubject.RefreshCommand.CanExecute(connectionInfo), "Connection is in progress so should not be enabled");
                this.outputWindowPane.AssertOutputStrings(0);

                // Act - log progress
                string message = controllerResult.ToString();
                progressEvents.SimulateStepExecutionChanged(message, double.NaN);

                // Verify prefix
                this.outputWindowPane.AssertOutputStrings(string.Format(CultureInfo.CurrentCulture, Strings.ConnectingToSonarQubePrefixMessageFormat, message));

                // Act - finish
                progressEvents.SimulateFinished(controllerResult);

                // Verify 
                Assert.IsTrue(testSubject.ConnectCommand.CanExecute(), "Connection is finished with result: {0}", controllerResult);
                Assert.IsTrue(testSubject.RefreshCommand.CanExecute(connectionInfo), "Connection is finished with result: {0}", controllerResult);
            }
        }