コード例 #1
0
 public void Finds_GitDirectory()
 {
     try
     {
         VersionAndBranchFinder.GetVersion(workDirectory, null, true, null);
     }
     catch (Exception ex)
     {
         // `RepositoryNotFoundException` means that it couldn't find the .git directory,
         // any other exception means that the .git was found but there was some other issue that this test doesn't care about.
         Assert.IsNotAssignableFrom <RepositoryNotFoundException>(ex);
     }
 }
コード例 #2
0
    public void ShouldBeAbleGetVersionFromGitDir()
    {
        var repoPath = Clone(ASBMTestRepoWorkingDirPath);

        using (var repo = new Repository(repoPath))
        {
            // Create a pull request branch from the parent of current develop tip
            repo.Branches.Add("pull/1735/merge", "develop~").ForceCheckout();

            AddOneCommitToHead(repo, "code");
        }
        CachedVersion versionAndBranch;

        VersionAndBranchFinder.TryGetVersion(ASBMTestRepoWorkingDirPath, out versionAndBranch, new Config());
        Assert.IsNotNull(versionAndBranch);
    }
コード例 #3
0
    public void Finds_GitDirectory_In_Parent()
    {
        var childDir = Path.Combine(workDirectory, "child");

        Directory.CreateDirectory(childDir);

        try
        {
            VersionAndBranchFinder.GetVersion(childDir, null, true, null);
        }
        catch (Exception ex)
        {
            // `RepositoryNotFoundException` means that it couldn't find the .git directory,
            // any other exception means that the .git was found but there was some other issue that this test doesn't care about.
            Assert.IsNotAssignableFrom <RepositoryNotFoundException>(ex);
        }
    }