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);
        }
 public void CreateResourcePathFileThrowsNotImplementedException170()
 {
     var mockanalyser = new Mock<ISonarLocalAnalyser>();
     AssociationModel associationModel;
     Resource resource;
     StandAloneVsHelper s0 = new StandAloneVsHelper();
     associationModel = new AssociationModel(null, null, null, null, null, null, mockanalyser.Object, "14.0");
     associationModel.UpdateServicesInModels(s0, null, null);
     Assert.Throws<NotImplementedException>(() => resource = associationModel.CreateResourcePathFile((string)null, (Resource)null));
 }
 public void CreateResourcePathFileIsNull()
 {
     var mockanalyser = new Mock<ISonarLocalAnalyser>();
     AssociationModel associationModel;
     associationModel =
       new AssociationModel(null, null, null, null, null, null, mockanalyser.Object, "14.0");
     Assert.That(associationModel.CreateResourcePathFile(null, null), Is.Null);
 }