public static void ValidateGitCommand( ScalarFunctionalTestEnlistment enlistment, ControlGitRepo controlGitRepo, string command, params object[] args) { command = string.Format(command, args); string controlRepoRoot = controlGitRepo.RootPath; string scalarRepoRoot = enlistment.RepoRoot; int pair_id = Interlocked.Increment(ref TraceCommandSequenceId); Dictionary <string, string> environmentVariables = new Dictionary <string, string>(); environmentVariables["GIT_QUIET"] = "true"; environmentVariables["GIT_COMMITTER_DATE"] = "Thu Feb 16 10:07:35 2017 -0700"; environmentVariables["XXX_SEQUENCE_ID"] = pair_id.ToString(); ProcessResult expectedResult = GitProcess.InvokeProcess(controlRepoRoot, command, environmentVariables); ProcessResult actualResult = GitHelpers.InvokeGitAgainstScalarRepo(scalarRepoRoot, command, environmentVariables); LinesShouldMatch(command + " Errors Lines", actualResult.Errors, expectedResult.Errors); LinesShouldMatch(command + " Output Lines", actualResult.Output, expectedResult.Output); if (command != "status") { ValidateGitCommand(enlistment, controlGitRepo, "status"); } }
public static void ValidateGitCommand( ScalarFunctionalTestEnlistment enlistment, ControlGitRepo controlGitRepo, string command, params object[] args) { command = string.Format(command, args); string controlRepoRoot = controlGitRepo.RootPath; string scalarRepoRoot = enlistment.RepoRoot; Dictionary <string, string> environmentVariables = new Dictionary <string, string>(); environmentVariables["GIT_QUIET"] = "true"; ProcessResult expectedResult = GitProcess.InvokeProcess(controlRepoRoot, command, environmentVariables); ProcessResult actualResult = GitHelpers.InvokeGitAgainstScalarRepo(scalarRepoRoot, command, environmentVariables); 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"); } }