public void CreateBugfixWithApostropheShouldReportAsInvalidWork()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartBugfix("X'");
        }
        public void CurrentBranchName()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            Assert.AreEqual("develop", gf.CurrentBranchLeafName);
        }
        public void StartFeatureShouldPutUsOnFeatureBranch()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);
            gf.Init(new GitFlowRepoSettings());
            gf.StartFeature("X");

            Assert.IsTrue(gf.IsOnFeatureBranch);
        }
        public void CheckNotInitialized()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            Assert.IsFalse(gf.IsInitialized);
            gf.Init(new GitFlowRepoSettings());
            Assert.IsTrue(gf.IsInitialized);
        }
        public void StartReleaseShouldPutUsOnReleaseBranch()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);
            gf.Init(new GitFlowRepoSettings());
            gf.StartRelease("2.0");

            Assert.IsTrue(gf.IsOnReleaseBranch);
        }
        public void StartReleaseShouldPutUsOnReleaseBranch()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartRelease("2.0");

            Assert.IsTrue(gf.IsOnReleaseBranch);
        }
        public void GetAllReleases()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartRelease("1.0");

            Assert.AreEqual(1, gf.AllReleases.Count());
        }
        public void StartBugfixShouldPutUsOnBugfixBranch()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartBugfix("X");

            Assert.IsTrue(gf.IsOnBugfixBranch);
        }
        public void GetStatusBugfix()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartBugfix("X");
            Assert.AreEqual("X", gf.CurrentBranchLeafName);
            Assert.AreEqual(gf.CurrentStatus, "Bugfix: X");
        }
        public void GetAllHotfixes()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartHotfix("hf1");

            Assert.AreEqual(1, gf.AllHotfixes.Count());
        }
        public void GetAllBugfixes()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartBugfix("X");
            gf.StartBugfix("Y");

            Assert.AreEqual(2, gf.AllBugfixes.Count());
        }
        public void StartBugfixWithSubFolder()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartBugfix("fd/Bugfix X");

            using (var repo = new Repository(sampleRepoPath))
            {
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "bugfix/fd/Bugfix_X"));
            }
        }
        public void FinishHotfixWithTagShouldTagRepo()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartHotfix("hf1");
            gf.FinishHotfix("hf1", "1.2.3", false);
            using (var repo = new Repository(sampleRepoPath))
            {
                Assert.AreEqual(1, repo.Tags.Count());
            }
        }
        public void StartFeatureWithSpaceShouldReplaceSpaceWithHyphen()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartFeature("Feature X");

            using (var repo = new Repository(sampleRepoPath))
            {
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "feature/Feature_X"));
            }
        }
        public void StartHotfix()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartHotfix("hf1");

            using (var repo = new Repository(sampleRepoPath))
            {
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "hotfix/hf1"));
            }
        }
        public void StartRelease()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartRelease("1.0");

            using (var repo = new Repository(sampleRepoPath))
            {
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "release/1.0"));
            }
        }
        public void FinishHotfix()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartHotfix("hf1");
            gf.FinishHotfix("hf1");
            using (var repo = new Repository(sampleRepoPath))
            {
                //Hotfix branch should be deleted (default option)
                Assert.IsFalse(repo.Branches.Any(b => !b.IsRemote && b.Name == "hotfix/hf1"));
            }
        }
        public void FinishRelease()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartRelease("1.0");
            gf.FinishRelease("1.0");
            using (var repo = new Repository(sampleRepoPath))
            {
                //Release branch should be deleted (default option)
                Assert.IsFalse(repo.Branches.Any(b => !b.IsRemote && b.Name == "release/1.0"));
            }
        }
 public void GitFlowInitWithInvalidMasterBranchShouldFail()
 {
     try
     {
         var gf = new GitFlowWrapper(sampleRepoPath);
         gf.Init(new GitFlowRepoSettings {
             MasterBranch = "master2"
         });
     }
     catch (Exception e)
     {
         Assert.IsTrue(e.Message.Contains("master2"));
     }
 }
        public void StartTwoBugfixesInParallel()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartBugfix("X");
            gf.StartBugfix("Y");

            using (var repo = new Repository(sampleRepoPath))
            {
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "bugfix/X"));
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "bugfix/Y"));
            }
        }
        public void FinishBugfixShouldRemoveIt()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartBugfix("X");
            gf.StartBugfix("Y");

            Assert.AreEqual(2, gf.AllBugfixes.Count());

            gf.FinishBugfix("X");

            Assert.AreEqual(1, gf.AllBugfixes.Count());
        }
        public void FinishBugfixSquashChanges()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartBugfix("X");

            Assert.AreEqual(1, gf.AllBugfixes.Count());

            gf.FinishBugfix("X", squash: true);

            using (var repo = new Repository(sampleRepoPath))
            {
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "bugfix/X"));
            }
        }
        public void FinishFeatureKeepLocalBranch()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.Init(new GitFlowRepoSettings());
            gf.StartFeature("X");

            Assert.AreEqual(1, gf.AllFeatures.Count());

            gf.FinishFeature("X", deleteLocalBranch: false);

            using (var repo = new Repository(sampleRepoPath))
            {
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "feature/X"));
            }
        }
        public void Init()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);

            gf.CommandOutputDataReceived += (sender, args) => { Console.Write(args.Output); };
            var result = gf.Init(new GitFlowRepoSettings());

            Assert.IsTrue(result.Success);

            Assert.IsTrue(gf.IsOnDevelopBranch);
            using (var repo = new Repository(sampleRepoPath))
            {
                var branches = repo.Branches.Where(b => !b.IsRemote).ToList();
                Assert.AreEqual(2, branches.Count());
                Assert.IsTrue(branches.Any(b => b.Name == "master"));
                Assert.IsTrue(branches.Any(b => b.Name == "develop"));
            }
        }
        public void GetAllFeatures()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);
            gf.Init(new GitFlowRepoSettings());
            gf.StartFeature("X");
            gf.StartFeature("Y");

            Assert.AreEqual(2, gf.AllFeatures.Count());
        }
        public void GetAllReleases()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);
            gf.Init(new GitFlowRepoSettings());
            gf.StartRelease("1.0");

            Assert.AreEqual(1, gf.AllReleases.Count());
        }
        public void GetAllHotfixes()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);
            gf.Init(new GitFlowRepoSettings());
            gf.StartHotfix("hf1");

            Assert.AreEqual(1, gf.AllHotfixes.Count());
        }
 public void FinishHotfix()
 {
     var gf = new GitFlowWrapper(sampleRepoPath);
     gf.Init(new GitFlowRepoSettings());
     gf.StartHotfix("hf1");
     gf.FinishHotfix("hf1");
     using (var repo = new Repository(sampleRepoPath))
     {
         //Hotfix branch should be deleted (default option)
         Assert.IsFalse(repo.Branches.Any(b => !b.IsRemote && b.Name == "hotfix/hf1"));
     }
 }
 public void DevelopBranchNameCanBeRetrieved()
 {
     var gf = new GitFlowWrapper(sampleRepoPath);
     gf.Init(new GitFlowRepoSettings());
     Assert.AreEqual("develop", gf.DevelopBranchName);
 }
 public void CurrentBranchName()
 {
     var gf = new GitFlowWrapper(sampleRepoPath);
     gf.Init(new GitFlowRepoSettings());
     Assert.AreEqual("develop", gf.CurrentBranchLeafName);
 }
        public void Init()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);
            gf.CommandOutputDataReceived += (sender, args) => { Console.Write(args.Output); };
            var result = gf.Init(new GitFlowRepoSettings());
            Assert.IsTrue(result.Success);

            Assert.IsTrue(gf.IsOnDevelopBranch);
            using (var repo = new Repository(sampleRepoPath))
            {
                var branches = repo.Branches.Where(b => !b.IsRemote).ToList();
                Assert.AreEqual(2, branches.Count());
                Assert.IsTrue(branches.Any(b => b.Name == "master"));
                Assert.IsTrue(branches.Any(b => b.Name == "develop"));
            }
        }
 public void FinishRelease()
 {
     var gf = new GitFlowWrapper(sampleRepoPath);
     gf.Init(new GitFlowRepoSettings());
     gf.StartRelease("1.0");
     gf.FinishRelease("1.0");
     using (var repo = new Repository(sampleRepoPath))
     {
         //Release branch should be deleted (default option)
         Assert.IsFalse(repo.Branches.Any(b => !b.IsRemote && b.Name == "release/1.0"));
     }
 }
 public void MasterBranchNameCanBeRetrievedWithADifferentName()
 {
     var gf = new GitFlowWrapper(sampleRepoPath);
     gf.Init(new GitFlowRepoSettings { MasterBranch = "somemaster" });
     Assert.AreEqual("somemaster", gf.MasterBranchName);
 }
        public void StartHotfix()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);
            gf.Init(new GitFlowRepoSettings());
            gf.StartHotfix("hf1");

            using (var repo = new Repository(sampleRepoPath))
            {
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "hotfix/hf1"));
            }
        }
        public void FinishFeatureShouldRemoveIt()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);
            gf.Init(new GitFlowRepoSettings());
            gf.StartFeature("X");
            gf.StartFeature("Y");

            Assert.AreEqual(2, gf.AllFeatures.Count());

            gf.FinishFeature("X");

            Assert.AreEqual(1, gf.AllFeatures.Count());
        }
        public void StartRelease()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);
            gf.Init(new GitFlowRepoSettings());
            gf.StartRelease("1.0");

            using (var repo = new Repository(sampleRepoPath))
            {
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "release/1.0"));
            }
        }
        public void StartTwoFeaturesInParallel()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);
            gf.Init(new GitFlowRepoSettings());
            gf.StartFeature("X");
            gf.StartFeature("Y");

            using (var repo = new Repository(sampleRepoPath))
            {
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "feature/X"));
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "feature/Y"));
            }
        }
 public void FinishHotfixWithTagShouldTagRepo()
 {
     var gf = new GitFlowWrapper(sampleRepoPath);
     gf.Init(new GitFlowRepoSettings());
     gf.StartHotfix("hf1");
     gf.FinishHotfix("hf1", "1.2.3", false);
     using (var repo = new Repository(sampleRepoPath))
     {
         Assert.AreEqual(1, repo.Tags.Count());
     }
 }
 public void GetStatus()
 {
     var gf = new GitFlowWrapper(sampleRepoPath);
     gf.Init(new GitFlowRepoSettings());
     gf.StartFeature("X");
     Assert.AreEqual("X", gf.CurrentBranchLeafName);
     Assert.AreEqual(gf.CurrentStatus, "Feature: X");
 }
 public void DevelopBranchNameCanBeRetrievedWithADifferentName()
 {
     var gf = new GitFlowWrapper(sampleRepoPath);
     gf.Init(new GitFlowRepoSettings { DevelopBranch = "somedevelop" });
     Assert.AreEqual("somedevelop", gf.DevelopBranchName);
 }
        public void StartFeatureWithSpaceShouldReplaceSpaceWithUnderscore()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);
            gf.Init(new GitFlowRepoSettings());
            gf.StartFeature("Feature X");

            using (var repo = new Repository(sampleRepoPath))
            {
                Assert.IsTrue(repo.Branches.Any(b => !b.IsRemote && b.Name == "feature/Feature_X"));
            }
        }
        public void StartHotfixShouldPutUsOnHotfixBranch()
        {
            var gf = new GitFlowWrapper(sampleRepoPath);
            gf.Init(new GitFlowRepoSettings());
            gf.StartHotfix("hf1");

            Assert.IsTrue(gf.IsOnHotfixBranch);
        }
 public void GitFlowInitWithInvalidMasterBranchShouldFail()
 {
     try
     {
         var gf = new GitFlowWrapper(sampleRepoPath);
         gf.Init(new GitFlowRepoSettings {MasterBranch = "master2"});
     }
     catch (Exception e)
     {
         Assert.IsTrue(e.Message.Contains("master2"));
     }
 }
 public void CheckNotInitialized()
 {
     var gf = new GitFlowWrapper(sampleRepoPath);
     Assert.IsFalse(gf.IsInitialized);
     gf.Init(new GitFlowRepoSettings());
     Assert.IsTrue(gf.IsInitialized);
 }
 public void MasterBranchNameCanBeRetrieved()
 {
     var gf = new GitFlowWrapper(sampleRepoPath);
     gf.Init(new GitFlowRepoSettings());
     Assert.AreEqual("master", gf.MasterBranchName);
 }