示例#1
0
        public void TestInitialize()
        {
            sourceControlledFileSystem = new Mock <ISourceControlledFileSystem>();
            credentialsLoader          = new Mock <ISolutionBindingCredentialsLoader>();
            solutionBindingFileLoader  = new Mock <ISolutionBindingFileLoader>();
            onSaveCallback             = new Mock <Action <string> >();

            testSubject = new SolutionBindingDataWriter(sourceControlledFileSystem.Object,
                                                        solutionBindingFileLoader.Object,
                                                        credentialsLoader.Object);

            mockCredentials = new BasicAuthCredentials("user", "pwd".ToSecureString());

            boundSonarQubeProject = new BoundSonarQubeProject(
                new Uri("http://xxx.www.zzz/yyy:9000"),
                "MyProject Key",
                "projectName",
                mockCredentials);

            sourceControlledFileSystem
            .Setup(x => x.QueueFileWrites(new List <string> {
                MockFilePath
            }, It.IsAny <Func <bool> >()))
            .Callback((IEnumerable <string> filePath, Func <bool> method) => method());
        }
        private ILocalService GetConfigurationPersister()
        {
            var connectedModeConfigPathProvider = new ConnectedModeSolutionBindingPathProvider(this);
            var legacyConfigPathProvider        = new LegacySolutionBindingPathProvider(this);
            var legacyConfigFolderItemAdder     = new LegacyConfigFolderItemAdder(this);

            var credentialsLoader = new SolutionBindingCredentialsLoader(credentialStoreService);
            var bindingFileLoader = new SolutionBindingFileLoader(Logger);

            var sccFileSystem = this.GetService <ISourceControlledFileSystem>();

            var solutionBindingDataWriter = new SolutionBindingDataWriter(sccFileSystem, bindingFileLoader, credentialsLoader);

            return(new ConfigurationPersister(legacyConfigPathProvider, connectedModeConfigPathProvider, solutionBindingDataWriter, legacyConfigFolderItemAdder));
        }