예제 #1
0
 public void Init_FlowIsInitialized()
 {
     using (_testRepository = new Repository(_testPath))
     {
         _testRepository.Flow().Init(new GitFlowRepoSettings(), author);
         Assert.True(_testRepository.Flow().IsInitialized());
     }
 }
예제 #2
0
        public void Feature_StartNewFeatureCreatesNewBranch()
        {
            using (_testRepository = new Repository(_testPath))
            {
                var fullBranchname = _testRepository.Flow().GetPrefixByBranch(GitFlowSetting.Feature) + "testFeature";
                var newBranch = _testRepository.Branches[fullBranchname];
                if (newBranch != null)
                    TestHelpers.DeleteBranch(_testRepository, newBranch);

                Assert.Null(_testRepository.Branches[fullBranchname]);
                var info = _testRepository.Flow().StartNewFeature("testFeature");
                Assert.NotNull(info);
                newBranch = _testRepository.Branches[fullBranchname];
                Assert.NotNull(newBranch);
                //TestHelpers.DeleteBranch(_testRepository,newBranch);
            }
        }
예제 #3
0
        public void Feature_PublishFeatureCreatesRemote()
        {
            using (_testRepository = new Repository(_testPath))
            {
                string branchName = TestHelpers.RandomString(8);
                var fullBranchname = _testRepository.Flow().GetPrefixByBranch(GitFlowSetting.Feature) + branchName;
                var newBranch = _testRepository.Branches[fullBranchname];
                if (newBranch != null)
                    TestHelpers.DeleteBranch(_testRepository, newBranch);

                var info = _testRepository.Flow().StartNewFeature(branchName);
                Assert.False(_testRepository.Branches[fullBranchname].IsTracking);
                _testRepository.Flow().PublishFeature(branchName);
                Assert.True(_testRepository.Branches[fullBranchname].IsTracking);
                //TestHelpers.DeleteBranch(_testRepository,newBranch);
            }
        }
예제 #4
0
        public void Init_FlowSetsConfigToDefaultValues()
        {
            using (_testRepository = new Repository(_testPath))
            {
                _testRepository.Flow().Init(new GitFlowRepoSettings(), author);

                //TODO Finish
                Assert.Equal(
                    _testRepository.Flow().GetPrefixByBranch(GitFlowSetting.Master),
                    GitFlowSetting.Master.GetAttribute<GitFlowConfigAttribute>().DefaultValue
                    );
                Assert.Equal(
                    _testRepository.Flow().GetPrefixByBranch(GitFlowSetting.Develop),
                    GitFlowSetting.Develop.GetAttribute<GitFlowConfigAttribute>().DefaultValue
                    );
            }
        }
예제 #5
0
 public void Init_EmptyFlowCreatesBranches()
 {
     using (_testRepository = new Repository(_testPath))
     {
         _testRepository.Flow().Init(new GitFlowRepoSettings(), author);
         Assert.Equal(_testRepository.Branches.Count(), 2);
         Assert.NotNull(_testRepository.Branches.FirstOrDefault(
                 x => string.Equals(x.FriendlyName, GitFlowSetting.Master.GetAttribute<GitFlowConfigAttribute>().DefaultValue, StringComparison.OrdinalIgnoreCase)));
         Assert.NotNull(_testRepository.Branches.FirstOrDefault(
                 x => string.Equals(x.FriendlyName, GitFlowSetting.Develop.GetAttribute<GitFlowConfigAttribute>().DefaultValue, StringComparison.OrdinalIgnoreCase)));
     }
 }
예제 #6
0
 public void Init_FlowWithExistingBranches(string masterBranch, string devBranch)
 {
     using (_testRepository = new Repository(_testPath))
     {
         var settings = new GitFlowRepoSettings();
         Signature committer = author;
         var opts = new CommitOptions { AllowEmptyCommit = true };
         _testRepository.Commit("Initial commit", author, committer, opts);
         TestHelpers.CreateLocalTestBranch(_testRepository, masterBranch, GitFlowSetting.Master, settings);
         TestHelpers.CreateLocalTestBranch(_testRepository, devBranch, GitFlowSetting.Develop, settings);
         _testRepository.Flow().Init(settings, author);
         Assert.NotNull(_testRepository.Branches.FirstOrDefault(
                 x => string.Equals(x.FriendlyName, settings.GetSetting(GitFlowSetting.Master), StringComparison.OrdinalIgnoreCase)));
         Assert.NotNull(_testRepository.Branches.FirstOrDefault(
                 x => string.Equals(x.FriendlyName, settings.GetSetting(GitFlowSetting.Develop), StringComparison.OrdinalIgnoreCase)));
     }
 }
예제 #7
0
 public void Init_TestRepositoryContainsDevelopBranch()
 {
     using (_testRepository = new Repository(_testPath))
     {
         _testRepository.Flow().Init(new GitFlowRepoSettings(), author);
         Assert.NotNull(_testRepository.Branches[ _testRepository.Flow().GetPrefixByBranch(GitFlowSetting.Develop)]);
     }
 }
예제 #8
0
 public void Init_TestPrefixIsSet()
 {
     using (_testRepository = new Repository(_testPath))
     {
         _testRepository.Flow().Init(new GitFlowRepoSettings(), author);
         var prefix = _testRepository.Flow().GetPrefixByBranch(GitFlowSetting.Develop);
         Assert.NotNull(prefix);
         Assert.NotEmpty(prefix);
     }
 }