public void ErrorListInfoBarController_InfoBar_ClickButton_HasConnectedActiveSection_NotBusy()
{
// Arrange
this.SetBindingMode(SonarLintMode.LegacyConnected);
var testSubject = new ErrorListInfoBarController(this.host, this.unboundProjectFinder);
this.ConfigureLoadedSolution();
int bindExecuted = 0;
bool canExecute = false;
ProjectViewModel project = null;
ConfigurableSectionController section = this.ConfigureActiveSectionWithBindCommand(args =>
{
bindExecuted++;
args.ProjectKey.Should().Be(project.Key);
args.ProjectName.Should().Be(project.ProjectName);
}, args => canExecute);
this.ConfigureActiveSectionWithRefreshCommand(c =>
{
FluentAssertions.Execution.Execute.Assertion.FailWith("Refresh is not expected to be called");
});
this.ConfigureActiveSectionWithDisconnectCommand(() =>
{
FluentAssertions.Execution.Execute.Assertion.FailWith("Disconnect is not expected to be called");
});
project = this.ConfigureProjectViewModel(section);
testSubject.Refresh();
RunAsyncAction();
this.outputWindowPane.Reset();
// Sanity
ConfigurableInfoBar infoBar = this.infoBarManager.AssertHasAttachedInfoBar(ErrorListInfoBarController.ErrorListToolWindowGuid);
VerifyInfoBar(infoBar);
// Act (command disabled)
infoBar.SimulateButtonClickEvent();
// Assert
this.teamExplorerController.ShowConnectionsPageCallsCount.Should().Be(1);
bindExecuted.Should().Be(0, "Update was not expected to be executed");
this.outputWindowPane.AssertOutputStrings(1);
// Act (command enabled)
canExecute = true;
infoBar.SimulateButtonClickEvent();
// Assert
this.teamExplorerController.ShowConnectionsPageCallsCount.Should().Be(2);
bindExecuted.Should().Be(1, "Update was expected to be executed");
this.infoBarManager.AssertHasNoAttachedInfoBar(ErrorListInfoBarController.ErrorListToolWindowGuid);
infoBar.VerifyAllEventsUnregistered();
this.outputWindowPane.AssertOutputStrings(1);
}