public void MountProcessLaunchedUsingCorrectArgs() { string executable = @"/bin/launchctl"; string gvfsBinPath = Path.Combine(this.gvfsPlatform.Constants.GVFSBinDirectoryPath, this.gvfsPlatform.Constants.GVFSExecutableName); string expectedArgs = $"asuser {ExpectedActiveUserId} {gvfsBinPath} mount {ExpectedActiveRepoPath}"; Mock <GVFSMountProcess.MountLauncher> mountLauncherMock = new Mock <GVFSMountProcess.MountLauncher>(MockBehavior.Strict, this.tracer); mountLauncherMock.Setup(mp => mp.LaunchProcess( executable, expectedArgs, ExpectedActiveRepoPath)) .Returns(true); string errorString = null; mountLauncherMock.Setup(mp => mp.WaitUntilMounted( this.tracer, ExpectedActiveRepoPath, It.IsAny <bool>(), out errorString)) .Returns(true); GVFSMountProcess mountProcess = new GVFSMountProcess(this.tracer, mountLauncherMock.Object); mountProcess.MountRepository(ExpectedActiveRepoPath, ExpectedActiveUserId); mountLauncherMock.VerifyAll(); }
public void Run() { GVFSMountProcess gvfs = new GVFSMountProcess(this.tracer, this.request.EnlistmentRoot); if (!gvfs.Mount( this.request.Verbosity, this.request.Keywords, this.request.ShowDebugWindow)) { NamedPipeMessages.MountRepoRequest.Response response = new NamedPipeMessages.MountRepoRequest.Response(); response.State = NamedPipeMessages.CompletionState.Failure; response.ErrorMessage = "Failed to mount, run 'gvfs log' for details"; this.WriteToClient(response); return; } if (!this.registry.TryRegisterRepo(this.request.EnlistmentRoot)) { this.tracer.RelatedError( "Successfully mounted repo at '{0}' but could not register it in GVFS.Service. See {1} log for more details.", this.request.EnlistmentRoot, GVFSConstants.Service.ServiceName); } this.WriteToClient(new NamedPipeMessages.MountRepoRequest.Response() { State = NamedPipeMessages.CompletionState.Success }); }