public void First_commit()
 {
     var branchingCommit = new MockCommit
                           {
                               MessageEx = "branching commit",
                           };
     var firstCommit = new MockCommit
                       {
                           MessageEx = "first commit on release",
                       };
     var releaseBranch = new MockBranch("release-0.5.0")
                         {
                             firstCommit,
                             branchingCommit,
                         };
     var finder = new ReleaseVersionFinder
                  {
                      ReleaseBranch = releaseBranch,
                      Commit = firstCommit,
                      Repository = new MockRepository
                                   {
                                       Branches = new MockBranchCollection
                                                  {
                                                      new MockBranch("develop")
                                                      {
                                                          branchingCommit
                                                      },
                                                      releaseBranch
                                                  },
                                       Tags = new MockTagCollection
                                              {
                                                  new MockTag
                                                  {
                                                      TargetEx = branchingCommit,
                                                      NameEx = "0.5.0-alpha5"
                                                  }
                                              }
                                   },
                  };
     var version = finder.FindVersion();
     Assert.AreEqual(0, version.Version.Major);
     Assert.AreEqual(5, version.Version.Minor);
     Assert.AreEqual(0, version.Version.Patch);
     Assert.AreEqual(Stability.Alpha, version.Version.Stability);
     Assert.AreEqual(BranchType.Release, version.BranchType);
     Assert.AreEqual(5, version.Version.PreReleasePartOne, "PreReleasePartOne should be set to 5 from the tag");
     Assert.AreEqual(1, version.Version.PreReleasePartTwo, "PreReleasePartTwo should be set to 1 since there is 1 commit");
 }
 public void Override_stage_using_tag()
 {
     var branchingCommit = new MockCommit
                           {
                               MessageEx = "branching commit",
                           };
     var firstCommit = new MockCommit
                       {
                           MessageEx = "first commit on release",
                       };
     var releaseBranch = new MockBranch("release-0.4.0")
                         {
                             firstCommit,
                             branchingCommit,
                         };
     var finder = new ReleaseVersionFinder
                  {
                      ReleaseBranch = releaseBranch,
                      Commit = firstCommit,
                      Repository = new MockRepository
                                   {
                                       Branches = new MockBranchCollection
                                                  {
                                                      new MockBranch("develop")
                                                      {
                                                          branchingCommit
                                                      },
                                                      releaseBranch
                                                  },
                                       Tags = new MockTagCollection
                                              {
                                                  new MockTag
                                                  {
                                                      TargetEx = branchingCommit,
                                                      NameEx = "0.4.0-RC4"
                                                  }
                                              }
                                   },
                  };
     var version = finder.FindVersion();
     //tag: 0.4.0-RC1 =>
     Assert.AreEqual(0, version.Version.Major);
     Assert.AreEqual(4, version.Version.Minor);
     Assert.AreEqual(0, version.Version.Patch);
     Assert.AreEqual(Stability.ReleaseCandidate, version.Version.Stability);
     Assert.AreEqual(BranchType.Release, version.BranchType);
     Assert.AreEqual(4, version.Version.PreReleasePartOne);
 }