예제 #1
0
        public void Initialize()
        {
            string asmDir = PathEx.GetDirectoryName(typeof(GitTests).Assembly.Location);

            this.rootDir = PathEx.Combine(asmDir, "test-root");
            DirectoryEx.Create(this.rootDir);
            DirectoryEx.Clear(this.rootDir);

            if (FileEx.Exists(credentialsFilePath))
            {
                var lines = File.ReadAllLines(credentialsFilePath);
                this.userName = lines[0];
                this.password = SecureStringExtensions.ToSecureString(lines[1]);
            }

            var fileOps = new TestFileOperationsExecuter(Path.Combine(this.rootDir, "agent"));

            //var fileOps = new SimulatedFileOperationsExecuter(fileOps);
            //fileOps.MessageLogged += (s, e) => TestLogger.Instance.Log(e.Level, e.Message);

            this.fileOps = fileOps;

            this.processExecuter = new TestRemoteProcessExecuter();
            this.jobExecuter     = new TestRemoteJobExecuter();
        }
예제 #2
0
 public GitCommandLineClient(string gitExePath, IRemoteProcessExecuter processExecuter, IFileOperationsExecuter fileOps, GitRepositoryInfo repository, ILogSink log, CancellationToken cancellationToken)
     : base(repository, log)
 {
     this.gitExePath        = gitExePath ?? throw new ArgumentNullException(nameof(gitExePath));
     this.processExecuter   = processExecuter ?? throw new ArgumentNullException(nameof(processExecuter));
     this.fileOps           = fileOps ?? throw new ArgumentNullException(nameof(fileOps));
     this.cancellationToken = cancellationToken;
 }
예제 #3
0
 internal SvnClient(UsernamePasswordCredentials credentials, IRemoteProcessExecuter execOps, string svnExePath, ILogSink log, CancellationToken?cancellationToken = null)
 {
     this.execOps           = new Lazy <IRemoteProcessExecuter>(() => execOps);
     this.userName          = credentials?.UserName;
     this.password          = credentials?.Password;
     this.svnExePath        = svnExePath;
     this.log               = log ?? (ILogSink)Logger.Null;
     this.cancellationToken = cancellationToken ?? CancellationToken.None;
 }