public void Run()
        {
            bool has_any_test_run = false;
            List<string> gitpaths = new List<string>();
            foreach (var version in GitVersions)
            {
                var git = String.Format(GitPath, version);
                if (!File.Exists(git))
                {
                    gitpaths.Add(git);
                    continue;
                }
                var resources = new MsysgitResources(version);

                Directory.CreateDirectory(WorkingDirectory);
                BackupServerRepository();

                try
                {
                    CloneEmptyRepository(git, resources);
                    PushFiles(git, resources);
                    PushTag(git, resources);
                    PushBranch(git, resources);
                    CloneRepository(git, resources);
                    PullRepository(git, resources);
                    PullTag(git, resources);
                    PullBranch(git, resources);
                }
                finally
                {
                    RestoreServerRepository();
                    DeleteDirectory(WorkingDirectory);
                }
                has_any_test_run = true;
            }

            if (!has_any_test_run)
            {
                Assert.Fail(string.Format("Please ensure that you have at least one git installation in '{0}'.", string.Join("', '", gitpaths.Select(n => Path.GetFullPath(n)))));
            }

        }
        private void PullTag(string git, MsysgitResources resources)
        {
            var result = RunGit(git, "fetch");

            Assert.AreEqual(String.Format(resources[MsysgitResources.Definition.PullTagError], RepositoryUrlWithoutCredentials), result.Item2);
        }
        private void PullBranch(string git, MsysgitResources resources)
        {
            var result = RunGit(git, "pull origin TestBranch");

            Assert.AreEqual("Already up-to-date.\n", result.Item1);
            Assert.AreEqual(String.Format(resources[MsysgitResources.Definition.PullBranchError], RepositoryUrlWithoutCredentials), result.Item2);
        }
 private void CloneEmptyRepository(string git, MsysgitResources resources)
 {
     var result = RunGit(git, String.Format(String.Format("clone {0}", RepositoryUrlWithCredentials), RepositoryName), WorkingDirectory);
     
     Assert.AreEqual(resources[MsysgitResources.Definition.CloneEmptyRepositoryOutput], result.Item1);
     Assert.AreEqual(resources[MsysgitResources.Definition.CloneEmptyRepositoryError], result.Item2);
 }
        private void PushFiles(string git, MsysgitResources resources)
        {
            CreateRandomFile(Path.Combine(RepositoryDirectory, "1.dat"), 10);
            CreateRandomFile(Path.Combine(RepositoryDirectory, "2.dat"), 1);
            Directory.CreateDirectory(Path.Combine(RepositoryDirectory, "SubDirectory"));
            CreateRandomFile(Path.Combine(RepositoryDirectory, "Subdirectory", "3.dat"), 20);
            CreateRandomFile(Path.Combine(RepositoryDirectory, "Subdirectory", "4.dat"), 15);

            RunGit(git, "add .");
            RunGit(git, "commit -m \"Test Files Added\"");
            var result = RunGit(git, "push origin master");

            Assert.AreEqual(String.Format(resources[MsysgitResources.Definition.PushFilesError], RepositoryUrlWithCredentials), result.Item2);
        }
 private void PushTag(string git, MsysgitResources resources)
 {
     RunGit(git, "tag -a v1.4 -m \"my version 1.4\"");
     var result = RunGit(git, "push --tags origin");
     
     Assert.AreEqual(String.Format(resources[MsysgitResources.Definition.PushTagError], RepositoryUrlWithCredentials), result.Item2);
 }
        private void PushBranch(string git, MsysgitResources resources)
        {
            RunGit(git, "checkout -b \"TestBranch\"");
            var result = RunGit(git, "push origin TestBranch");

            Assert.AreEqual(String.Format(resources[MsysgitResources.Definition.PushBranchError], RepositoryUrlWithCredentials), result.Item2);
        }
        private void PullRepository(string git, MsysgitResources resources)
        {
            DeleteDirectory(RepositoryDirectory);
            Directory.CreateDirectory(RepositoryDirectory);

            RunGit(git, "init");
            RunGit(git, String.Format("remote add origin {0}", RepositoryUrlWithCredentials));
            var result = RunGit(git, "pull origin master");

            Assert.AreEqual(String.Format(resources[MsysgitResources.Definition.PullRepositoryError], RepositoryUrlWithoutCredentials), result.Item2);
        }