private void Create_Branch_If_It_Does_Not_Exist(TestCommitWithBranch testCommit, Repository repo) { if (Valid_Branch_Name(testCommit) && Not_Master_Branch(testCommit) && Branch_Does_Not_Exist(repo, testCommit)) { repo.CreateBranch(_branch); } }
private static void Checkout_Branch(TestCommitWithBranch testCommit, Repository repo) { if (Valid_Branch_Name(testCommit)) { var branch = repo.Branches[testCommit.Branch]; if (branch != null) { Commands.Checkout(repo, branch); } } }
private static bool Not_Master_Branch(TestCommitWithBranch testCommit) { return(testCommit.Branch != MasterBranch); }
private static bool Valid_Branch_Name(TestCommitWithBranch testCommit) { return(!string.IsNullOrEmpty(testCommit.Branch)); }
private static bool Branch_Does_Not_Exist(Repository repo, TestCommitWithBranch testCommit) { return(repo.Branches.All(x => x.FriendlyName != testCommit.Branch)); }