Пример #1
0
        public void WhenAtLeastOneParameterDoesntMatch_ThenThePullRequestIsNotAMatch(
            string repositoryNamePattern,
            string targetBranchName,
            string status)
        {
            var sut = new PullRequestMatcher(
                repositoryNamePattern,
                targetBranchName,
                status);

            sut.IsMatch(_pullRequest).Should().BeFalse();
        }
Пример #2
0
        public void WhenAllParametersMatch_ThenThePullRequestIsAMatch(
            string repositoryNamePattern,
            string targetBranchName,
            string status)
        {
            var sut = new PullRequestMatcher(
                repositoryNamePattern,
                targetBranchName,
                status);

            sut.IsMatch(_pullRequest).Should().BeTrue();
        }
        public async Task Handle(GitPullRequestUpdatedPayload pullRequest)
        {
            if (_pullRequestMatcher.IsMatch(pullRequest))
            {
                Log.Information("Pull request matches, checking for pending builds for {BuildDefinitionName} on project {ProjectName}", _buildDefinitionName, _projectName);
                if (await _tfsService.ArePendingBuilds(_projectName, _buildDefinitionName))
                {
                    Log.Information("Found pending build(s), not queuing another one");
                }
                else
                {
                    Log.Information("No build(s) pending, queuing another one");
                    await _tfsService.QueueNewBuild(_projectName, _buildDefinitionName);

                    Log.Information("New build successfully queued");
                }
            }
        }