/// <summary>
        /// Checks if a specific commit hash is the last commit on the source branch of a pull request.
        /// </summary>
        /// <param name="capability">Pull request system capability.</param>
        /// <param name="commitId">Hash of the commit ID to check.</param>
        /// <returns>True if the commit ID is the last commit on the source branch.</returns>
        public static bool IsCurrentCommitId(this ISupportCheckingCommitId capability, string commitId)
        {
            capability.NotNull(nameof(capability));
            commitId.NotNullOrWhiteSpace(nameof(commitId));

            var lastSourceCommitId = capability.GetLastSourceCommitId();

            return
                (!string.IsNullOrWhiteSpace(lastSourceCommitId) &&
                 lastSourceCommitId.Equals(commitId, StringComparison.InvariantCultureIgnoreCase));
        }
示例#2
0
            public void Should_Throw_If_PullRequestSystem_Is_Null()
            {
                // Given
                ISupportCheckingCommitId capability = null;

                // When
                var result = Record.Exception(() => capability.IsCurrentCommitId(string.Empty));

                // Then
                result.IsArgumentNullException("capability");
            }