AssignASonarProjectToSolution() 공개 메소드

The on assign project command.
public AssignASonarProjectToSolution ( Resource project, Resource branchProject, ISourceControlProvider sourceControl, bool skipRegisterModels = false ) : bool
project VSSonarPlugins.Types.Resource
branchProject VSSonarPlugins.Types.Resource The branch project.
sourceControl ISourceControlProvider
skipRegisterModels bool
리턴 bool
        public void AssignProjectIsNotMainReturnsTrue()
        {
            var mockTranslator = new Mock<ISQKeyTranslator>();
            var mockRest = new Mock<ISonarRestService>();
            var mockLogger = new Mock<INotificationManager>();
            var mockPlugin = new Mock<IPluginManager>();
            var mockConfiguration = new Mock<IConfigurationHelper>();
            var mockSourceProvider = new Mock<ISourceControlProvider>();
            var mockVsHelper = new Mock<IVsEnvironmentHelper>();
            var mockanalyser = new Mock<ISonarLocalAnalyser>();

            mockConfiguration.Setup(x => x.ReadSetting(It.IsAny<Context>(), It.IsAny<string>(), It.IsAny<string>())).Returns(new SonarQubeProperties() { Value = "dummy"});
            var mockObj = mockConfiguration.Object;

            AssociationModel associationModel;
            associationModel = new AssociationModel(mockLogger.Object, mockRest.Object, mockObj, mockTranslator.Object, mockPlugin.Object, new SonarQubeViewModel("test", mockObj), mockanalyser.Object, "14.0");
            associationModel.UpdateServicesInModels(mockVsHelper.Object, null, null);

            Assert.That(associationModel.AssignASonarProjectToSolution(new Resource() { IsBranch = false }, null, mockSourceProvider.Object), Is.True);
            Assert.That(associationModel.IsAssociated, Is.True);
        }
        public void AssignWhenProjectIsMainAndBranchIsNullReturnsFalse()
        {
            var mockTranslator = new Mock<ISQKeyTranslator>();
            var mockRest = new Mock<ISonarRestService>();
            var mockLogger = new Mock<INotificationManager>();
            var mockConfiguration = new Mock<IConfigurationHelper>();
            var mockPlugin = new Mock<IPluginManager>();
            var mockSourceProvider = new Mock<ISourceControlProvider>();
            var mockVsHelper = new Mock<IVsEnvironmentHelper>();
            var mockanalyser = new Mock<ISonarLocalAnalyser>();

            AssociationModel associationModel;
            associationModel = new AssociationModel(mockLogger.Object, mockRest.Object, mockConfiguration.Object, mockTranslator.Object, mockPlugin.Object, new SonarQubeViewModel("test", mockConfiguration.Object), mockanalyser.Object, "14.0");
            associationModel.UpdateServicesInModels(mockVsHelper.Object, null, null);

            Assert.That(associationModel.AssignASonarProjectToSolution(new Resource() { IsBranch = true }, null, mockSourceProvider.Object), Is.False);
        }