public void IsVersionDefined_Commit()
    {
        this.InitializeSourceControl();
        this.AddCommits();
        Assert.False(VersionFile.IsVersionDefined(this.Repo.Head.Commits.First()));

        this.WriteVersionFile();

        // Verify that we can find the version.txt file in the most recent commit,
        // But not in the initial commit.
        Assert.True(VersionFile.IsVersionDefined(this.Repo.Head.Commits.First()));
        Assert.False(VersionFile.IsVersionDefined(this.Repo.Head.Commits.Last()));
    }
    public void IsVersionDefined_String_ConsiderAncestorFolders()
    {
        // Construct a repo where versions are defined like this:

        /*   root <- 1.0
         *      a             (inherits 1.0)
         *          b <- 1.1
         *               c    (inherits 1.1)
         */
        VersionFile.SetVersion(this.RepoPath, new Version(1, 0));
        string subDirA   = Path.Combine(this.RepoPath, "a");
        string subDirAB  = Path.Combine(subDirA, "b");
        string subDirABC = Path.Combine(subDirAB, "c");

        Directory.CreateDirectory(subDirABC);
        VersionFile.SetVersion(subDirAB, new Version(1, 1));

        Assert.True(VersionFile.IsVersionDefined(subDirABC));
        Assert.True(VersionFile.IsVersionDefined(subDirAB));
        Assert.True(VersionFile.IsVersionDefined(subDirA));
        Assert.True(VersionFile.IsVersionDefined(this.RepoPath));
    }
 public void IsVersionDefined_String_NullOrEmpty()
 {
     Assert.Throws <ArgumentNullException>(() => VersionFile.IsVersionDefined((string)null));
     Assert.Throws <ArgumentException>(() => VersionFile.IsVersionDefined(string.Empty));
 }
 public void IsVersionDefined_Commit_Null()
 {
     Assert.False(VersionFile.IsVersionDefined((Commit)null));
 }