public async Task EvaluateShouldReturnFalseForRepoNotMatchingPolicies() { //Arrange CustomizeGitRef(_fixture); SetupPoliciesResolver(_policiesResolver, _fixture); SetupClient(_client, _fixture); //Act var rule = new ReleaseBranchesProtectedByPolicies(_client, _policiesResolver); var evaluatedRule = await rule.EvaluateAsync("", RepositoryId); //Assert evaluatedRule.ShouldBe(false); }
public async Task EvaluateShouldReturnFalseWhenThereAreNoCorrectPoliciesForMasterBranch() { //Arrange CustomizeScope(_fixture, refName: "ref/heads/not-master"); CustomizeMinimumNumberOfReviewersPolicy(_fixture); CustomizePolicySettings(_fixture); CustomizeGitRef(_fixture); SetupPoliciesResolver(_policiesResolver, _fixture); SetupClient(_client, _fixture); //Act var rule = new ReleaseBranchesProtectedByPolicies(_client, _policiesResolver); var evaluatedRule = await rule.EvaluateAsync("", RepositoryId); //Assert evaluatedRule.ShouldBe(false); }
public async Task EvaluateShouldReturnFalseWhenPolicyIsNotEnabled() { //Arrange CustomizeScope(_fixture, RepositoryId); CustomizeMinimumNumberOfReviewersPolicy(_fixture, false); CustomizePolicySettings(_fixture); CustomizeGitRef(_fixture); SetupPoliciesResolver(_policiesResolver, _fixture); SetupClient(_client, _fixture); //Act var rule = new ReleaseBranchesProtectedByPolicies(_client, _policiesResolver); var evaluatedRule = await rule.EvaluateAsync("", RepositoryId); //Assert evaluatedRule.ShouldBe(false); }