public void OnDisconectInNotAssociatedShouldClearAllData() { mockConfiguration.Setup(x => x.ReadSetting(It.IsAny <Context>(), It.IsAny <string>(), It.IsAny <string>())).Returns(new SonarQubeProperties { Value = "dummy" }); mockRest.Setup(x => x.GetProjectsList(It.IsAny <ISonarConfiguration>())).Returns(this.CreatProjects()); var associationModel = new SonarQubeViewModel("test", mockConfiguration.Object, mockLogger.Object, mockTranslator.Object, mockRest.Object, locaAnalyser: mockAnalyser.Object); associationModel.RefreshProjectList(false); Assert.That(associationModel.AvailableProjects.Count, Is.EqualTo(2)); associationModel.OnDisconnectToSonar(); Assert.That(associationModel.AvailableProjects.Count, Is.EqualTo(0)); Assert.That(associationModel.SelectedProjectInView, Is.Null); Assert.That(associationModel.SelectedProjectName, Is.EqualTo("")); Assert.That(associationModel.SelectedProjectKey, Is.EqualTo("")); Assert.That(associationModel.SelectedProjectVersion, Is.EqualTo("")); Assert.That(associationModel.IsConnected, Is.False); }
public void OnDisconectInNotAssociatedShouldClearAllData() { mockConfiguration.Setup(x => x.ReadSetting(It.IsAny<Context>(), It.IsAny<string>(), It.IsAny<string>())).Returns(new SonarQubeProperties { Value = "dummy" }); mockRest.Setup(x => x.GetProjectsList(It.IsAny<ISonarConfiguration>())).Returns(this.CreatProjects()); var associationModel = new SonarQubeViewModel("test", mockConfiguration.Object, mockLogger.Object, mockTranslator.Object, mockRest.Object, locaAnalyser: mockAnalyser.Object); associationModel.RefreshProjectList(false); Assert.That(associationModel.AvailableProjects.Count, Is.EqualTo(2)); associationModel.OnDisconnectToSonar(); Assert.That(associationModel.AvailableProjects.Count, Is.EqualTo(0)); Assert.That(associationModel.SelectedProjectInView, Is.Null); Assert.That(associationModel.SelectedProjectName, Is.EqualTo("")); Assert.That(associationModel.SelectedProjectKey, Is.EqualTo("")); Assert.That(associationModel.SelectedProjectVersion, Is.EqualTo("")); Assert.That(associationModel.IsConnected, Is.False); }