Exemplo n.º 1
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (DisplayName != null)
                {
                    hashCode = hashCode * 59 + DisplayName.GetHashCode();
                }

                hashCode = hashCode * 59 + EstimatedDurationInMillis.GetHashCode();
                if (LatestRun != null)
                {
                    hashCode = hashCode * 59 + LatestRun.GetHashCode();
                }
                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }
                if (Organization != null)
                {
                    hashCode = hashCode * 59 + Organization.GetHashCode();
                }

                hashCode = hashCode * 59 + WeatherScore.GetHashCode();
                if (BranchNames != null)
                {
                    hashCode = hashCode * 59 + BranchNames.GetHashCode();
                }

                hashCode = hashCode * 59 + NumberOfFailingBranches.GetHashCode();

                hashCode = hashCode * 59 + NumberOfFailingPullRequests.GetHashCode();

                hashCode = hashCode * 59 + NumberOfSuccessfulBranches.GetHashCode();

                hashCode = hashCode * 59 + NumberOfSuccessfulPullRequests.GetHashCode();

                hashCode = hashCode * 59 + TotalNumberOfBranches.GetHashCode();

                hashCode = hashCode * 59 + TotalNumberOfPullRequests.GetHashCode();
                if (Class != null)
                {
                    hashCode = hashCode * 59 + Class.GetHashCode();
                }
                return(hashCode);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns true if MultibranchPipeline instances are equal
        /// </summary>
        /// <param name="other">Instance of MultibranchPipeline to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(MultibranchPipeline other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     DisplayName == other.DisplayName ||
                     DisplayName != null &&
                     DisplayName.Equals(other.DisplayName)
                     ) &&
                 (
                     EstimatedDurationInMillis == other.EstimatedDurationInMillis ||
                     EstimatedDurationInMillis != null &&
                     EstimatedDurationInMillis.Equals(other.EstimatedDurationInMillis)
                 ) &&
                 (
                     LatestRun == other.LatestRun ||
                     LatestRun != null &&
                     LatestRun.Equals(other.LatestRun)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Organization == other.Organization ||
                     Organization != null &&
                     Organization.Equals(other.Organization)
                 ) &&
                 (
                     WeatherScore == other.WeatherScore ||
                     WeatherScore != null &&
                     WeatherScore.Equals(other.WeatherScore)
                 ) &&
                 (
                     BranchNames == other.BranchNames ||
                     BranchNames != null &&
                     BranchNames.SequenceEqual(other.BranchNames)
                 ) &&
                 (
                     NumberOfFailingBranches == other.NumberOfFailingBranches ||
                     NumberOfFailingBranches != null &&
                     NumberOfFailingBranches.Equals(other.NumberOfFailingBranches)
                 ) &&
                 (
                     NumberOfFailingPullRequests == other.NumberOfFailingPullRequests ||
                     NumberOfFailingPullRequests != null &&
                     NumberOfFailingPullRequests.Equals(other.NumberOfFailingPullRequests)
                 ) &&
                 (
                     NumberOfSuccessfulBranches == other.NumberOfSuccessfulBranches ||
                     NumberOfSuccessfulBranches != null &&
                     NumberOfSuccessfulBranches.Equals(other.NumberOfSuccessfulBranches)
                 ) &&
                 (
                     NumberOfSuccessfulPullRequests == other.NumberOfSuccessfulPullRequests ||
                     NumberOfSuccessfulPullRequests != null &&
                     NumberOfSuccessfulPullRequests.Equals(other.NumberOfSuccessfulPullRequests)
                 ) &&
                 (
                     TotalNumberOfBranches == other.TotalNumberOfBranches ||
                     TotalNumberOfBranches != null &&
                     TotalNumberOfBranches.Equals(other.TotalNumberOfBranches)
                 ) &&
                 (
                     TotalNumberOfPullRequests == other.TotalNumberOfPullRequests ||
                     TotalNumberOfPullRequests != null &&
                     TotalNumberOfPullRequests.Equals(other.TotalNumberOfPullRequests)
                 ) &&
                 (
                     Class == other.Class ||
                     Class != null &&
                     Class.Equals(other.Class)
                 ));
        }