Ejemplo n.º 1
0
        public BindingProcessImpl(IHost host,
                                  BindCommandArgs bindingArgs,
                                  ISolutionBindingOperation solutionBindingOperation,
                                  INuGetBindingOperation nugetBindingOperation,
                                  IUnboundProjectFinder unboundProjectFinder,
                                  IBindingConfigProvider bindingConfigProvider,
                                  SonarLintMode bindingMode,
                                  bool isFirstBinding = false)
        {
            this.host        = host ?? throw new ArgumentNullException(nameof(host));
            this.bindingArgs = bindingArgs ?? throw new ArgumentNullException(nameof(bindingArgs));
            this.solutionBindingOperation = solutionBindingOperation ?? throw new ArgumentNullException(nameof(solutionBindingOperation));
            this.NuGetBindingOperation    = nugetBindingOperation ?? throw new ArgumentNullException(nameof(nugetBindingOperation));
            this.unboundProjectFinder     = unboundProjectFinder ?? throw new ArgumentNullException(nameof(unboundProjectFinder));
            this.bindingConfigProvider    = bindingConfigProvider ?? throw new ArgumentNullException(nameof(bindingConfigProvider));
            this.bindingMode = bindingMode;

            Debug.Assert(bindingArgs.ProjectKey != null);
            Debug.Assert(bindingArgs.ProjectName != null);
            Debug.Assert(bindingArgs.Connection != null);

            this.projectSystem = this.host.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.InternalState = new BindingProcessState(isFirstBinding);
        }
        private BindingProcessImpl CreateTestSubject(string projectKey = "anykey", string projectName = "anyname",
                                                     INuGetBindingOperation nuGetBindingOperation = null,
                                                     IBindingConfigProvider configProvider        = null)
        {
            nuGetBindingOperation = nuGetBindingOperation ?? new NoOpNuGetBindingOperation(this.host.Logger);
            configProvider        = configProvider ?? new Mock <IBindingConfigProvider>().Object;

            this.host.SonarQubeService = this.sonarQubeServiceMock.Object;
            var bindingArgs = new BindCommandArgs(projectKey, projectName, new ConnectionInformation(new Uri("http://connected")));

            var slnBindOperation = new SolutionBindingOperation(this.host, bindingArgs.Connection, projectKey, "projectName", SonarLintMode.LegacyConnected, this.host.Logger);
            var finder           = new ConfigurableUnboundProjectFinder();

            return(new BindingProcessImpl(this.host, bindingArgs, slnBindOperation, nuGetBindingOperation, finder, configProvider));
        }
        private BindingProcessImpl CreateTestSubject(BindCommandArgs bindingArgs = null,
                                                     INuGetBindingOperation nuGetBindingOperation = null,
                                                     IBindingConfigProvider configProvider        = null,
                                                     SonarLintMode mode = SonarLintMode.Connected)
        {
            bindingArgs           = bindingArgs ?? new BindCommandArgs("key", "name", new ConnectionInformation(new Uri("http://connected")));
            nuGetBindingOperation = nuGetBindingOperation ?? new NoOpNuGetBindingOperation(this.host.Logger);
            configProvider        = configProvider ?? new Mock <IBindingConfigProvider>().Object;

            this.host.SonarQubeService = this.sonarQubeServiceMock.Object;

            var slnBindOperation = new SolutionBindingOperation(this.host, SonarLintMode.LegacyConnected, this.host.Logger);
            var finder           = new ConfigurableUnboundProjectFinder();

            return(new BindingProcessImpl(this.host, bindingArgs, slnBindOperation, nuGetBindingOperation, finder, configProvider, mode));
        }