Bonobo.Git.Server.Test.Integration.ClAndWeb.MsysgitIntegrationTests.ClassInit C# (CSharp) Method

ClassInit() private method

private ClassInit ( Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext ) : void
testContext Microsoft.VisualStudio.TestTools.UnitTesting.TestContext
return void
        public static void ClassInit(TestContext testContext)
        {
            // Make sure relative paths are frozen in case the app's CurrentDir changes
            // WorkingDirectory = Path.GetFullPath(WorkingDirectory);
            // GitPath = Path.GetFullPath(GitPath);
            // RepositoryDirectory = Path.Combine(WorkingDirectory, RepositoryName);

            List<string> not_found = new List<string>();

            foreach (var version in GitVersions)
            {
                var git = String.Format(GitPath, version);
                if (File.Exists(git))
                {
                    installedgits.Add(new GitInstance { GitExe =  git, Resources =  new MsysgitResources(version) });
                }
                else
                {
                    not_found.Add(git);
                }
            }

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

            lc = AssemblyStartup.LoadedConfig;

            AdminCredentials = lc.getUrlLogin("admin") + "@";
            UserCredentials = lc.getUrlLogin("user") + "@";

            Directory.CreateDirectory(WorkingDirectory);

            if (AnyCredentialHelperExists(installedgits.Last()))
            {
                /* At the moment there is no reliable way of overriding credential.helper on a global basis.
                 * See the other comments for all the other bugs found so far.
                 * Having a credential helper set makes it impossible to check in non authorized login
                 * after a login with username and password has been done. */
                Assert.Fail("Cannot have any credential.helpers configured for integration tests.");
            }

            app = new MvcWebApp();
            ITH = new IntegrationTestHelpers(app, lc);

            RepositoryUrlWithCredentials = String.Format(RepositoryUrlTemplate, AdminCredentials, ".git", RepositoryName);
            RepositoryUrlWithoutCredentials = String.Format(RepositoryUrlTemplate, String.Empty, String.Empty, RepositoryName);
            Url = string.Format(RepositoryUrlTemplate, string.Empty, string.Empty, string.Empty);
            BareUrl = Url.TrimEnd('/');
        }