Пример #1
0
        public static ProcessResult InvokeGitAgainstGVFSRepo(string gvfsRepoRoot, string command, bool cleanErrors = true)
        {
            ProcessResult result = GitProcess.InvokeProcess(gvfsRepoRoot, command);

            string errors = result.Errors;

            if (cleanErrors)
            {
                string[] lines = errors.Split(new string[] { "\r\n" }, StringSplitOptions.None);
                errors = string.Join("\r\n", lines.Where(line => !line.StartsWith("Waiting for ")));
            }

            return(new ProcessResult(
                       result.Output,
                       errors,
                       result.ExitCode));
        }
Пример #2
0
        public static void ValidateGitCommand(
            GVFSFunctionalTestEnlistment enlistment,
            ControlGitRepo controlGitRepo,
            string command,
            params object[] args)
        {
            string controlRepoRoot = controlGitRepo.RootPath;
            string gvfsRepoRoot    = enlistment.RepoRoot;

            command = string.Format(command, args);
            ProcessResult expectedResult = GitProcess.InvokeProcess(controlRepoRoot, command);
            ProcessResult actualResult   = GitHelpers.InvokeGitAgainstGVFSRepo(gvfsRepoRoot, command);

            actualResult.Output.ShouldEqual(expectedResult.Output);
            actualResult.Errors.ShouldEqual(expectedResult.Errors);

            if (command != "status")
            {
                ValidateGitCommand(enlistment, controlGitRepo, "status");
            }
        }
Пример #3
0
        public static void ValidateGitCommand(
            GVFSFunctionalTestEnlistment enlistment,
            ControlGitRepo controlGitRepo,
            string command,
            params object[] args)
        {
            command = string.Format(command, args);
            string controlRepoRoot = controlGitRepo.RootPath;
            string gvfsRepoRoot    = enlistment.RepoRoot;

            ProcessResult expectedResult = GitProcess.InvokeProcess(controlRepoRoot, command);
            ProcessResult actualResult   = GitHelpers.InvokeGitAgainstGVFSRepo(gvfsRepoRoot, command);

            ErrorsShouldMatch(command, expectedResult, actualResult);
            actualResult.Output.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
            .ShouldMatchInOrder(expectedResult.Output.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries), LinesAreEqual, command + " Output Lines");

            if (command != "status")
            {
                ValidateGitCommand(enlistment, controlGitRepo, "status");
            }
        }