public void OnSolutionOpenButProjectNotFoundItShouldNotAssociate() { mockRest.Setup(x => x.GetProjectsList(It.IsAny <ISonarConfiguration>())).Returns(this.CreatProjects()); mockRest.Setup(x => x.AuthenticateUser(It.IsAny <ISonarConfiguration>())).Returns(true); mockVsHelper.Setup(x => x.ActiveSolutionName()).Returns("solutionaname"); mockVsHelper.Setup(x => x.ActiveSolutionPath()).Returns("solutionapath"); mockPlugin.Setup(x => x.SourceCodePlugins).Returns(new List <ISourceVersionPlugin>()); AuthtenticationHelper.EstablishAConnection(mockRest.Object, "as", "asda", "asd"); var associationModel = new SonarQubeViewModel("test", mockConfiguration.Object, mockLogger.Object, mockTranslator.Object, mockRest.Object, mockSourceProvider.Object, mockPlugin.Object, locaAnalyser: mockAnalyser.Object); associationModel.AssociationModule.AssociatedProject = new Resource(); associationModel.SelectedProjectKey = "jasd"; associationModel.SelectedProjectName = "jasd"; associationModel.SelectedProjectVersion = "jasd"; associationModel.VsHelper = mockVsHelper.Object; associationModel.IsSolutionOpen = true; associationModel.IsConnected = true; associationModel.OnSolutionOpen("abc", "dfc", "sds"); WaitForCompletionOrTimeout(associationModel); Assert.That(associationModel.AssociationModule.IsAssociated, Is.False); Assert.That(associationModel.IsConnected, Is.True); Assert.That(associationModel.ErrorIsFound, Is.True); Assert.That(associationModel.ShowRightFlyout, Is.True); Assert.That(associationModel.StatusMessage, Is.EqualTo("Was unable to associate with sonar project, use project association dialog to choose a project or to provision project")); Assert.That(associationModel.AssociationModule.AssociatedProject, Is.Null); Assert.That(associationModel.SelectedProjectName, Is.Null); Assert.That(associationModel.SelectedProjectKey, Is.Null); Assert.That(associationModel.SelectedProjectVersion, Is.Null); }
public void OnSolutionOpenButProjectNotFoundItShouldNotAssociate() { mockRest.Setup(x => x.GetProjectsList(It.IsAny<ISonarConfiguration>())).Returns(this.CreatProjects()); mockRest.Setup(x => x.AuthenticateUser(It.IsAny<ISonarConfiguration>())).Returns(true); mockVsHelper.Setup(x => x.ActiveSolutionName()).Returns("solutionaname"); mockVsHelper.Setup(x => x.ActiveSolutionPath()).Returns("solutionapath"); mockPlugin.Setup(x => x.SourceCodePlugins).Returns(new List<ISourceVersionPlugin>()); AuthtenticationHelper.EstablishAConnection(mockRest.Object, "as", "asda", "asd"); var associationModel = new SonarQubeViewModel("test", mockConfiguration.Object, mockLogger.Object, mockTranslator.Object, mockRest.Object, mockSourceProvider.Object, mockPlugin.Object, locaAnalyser: mockAnalyser.Object); associationModel.AssociationModule.AssociatedProject = new Resource(); associationModel.SelectedProjectKey = "jasd"; associationModel.SelectedProjectName = "jasd"; associationModel.SelectedProjectVersion = "jasd"; associationModel.VsHelper = mockVsHelper.Object; associationModel.IsSolutionOpen = true; associationModel.IsConnected = true; associationModel.OnSolutionOpen("abc", "dfc", "sds"); WaitForCompletionOrTimeout(associationModel); Assert.That(associationModel.AssociationModule.IsAssociated, Is.False); Assert.That(associationModel.IsConnected, Is.True); Assert.That(associationModel.ErrorIsFound, Is.True); Assert.That(associationModel.ShowRightFlyout, Is.True); Assert.That(associationModel.StatusMessage, Is.EqualTo("Was unable to associate with sonar project, use project association dialog to choose a project or to provision project")); Assert.That(associationModel.AssociationModule.AssociatedProject, Is.Null); Assert.That(associationModel.SelectedProjectName, Is.Null); Assert.That(associationModel.SelectedProjectKey, Is.Null); Assert.That(associationModel.SelectedProjectVersion, Is.Null); }