Example #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 (Id != null)
                {
                    hashCode = hashCode * 59 + Id.GetHashCode();
                }
                if (StepId != null)
                {
                    hashCode = hashCode * 59 + StepId.GetHashCode();
                }
                if (PhaseId != null)
                {
                    hashCode = hashCode * 59 + PhaseId.GetHashCode();
                }
                if (Action != null)
                {
                    hashCode = hashCode * 59 + Action.GetHashCode();
                }
                if (Repository != null)
                {
                    hashCode = hashCode * 59 + Repository.GetHashCode();
                }
                if (Branch != null)
                {
                    hashCode = hashCode * 59 + Branch.GetHashCode();
                }
                if (Environment != null)
                {
                    hashCode = hashCode * 59 + Environment.GetHashCode();
                }
                if (EnvironmentType != null)
                {
                    hashCode = hashCode * 59 + EnvironmentType.GetHashCode();
                }
                if (StartedAt != null)
                {
                    hashCode = hashCode * 59 + StartedAt.GetHashCode();
                }
                if (FinishedAt != null)
                {
                    hashCode = hashCode * 59 + FinishedAt.GetHashCode();
                }
                if (Details != null)
                {
                    hashCode = hashCode * 59 + Details.GetHashCode();
                }

                hashCode = hashCode * 59 + Status.GetHashCode();
                if (Links != null)
                {
                    hashCode = hashCode * 59 + Links.GetHashCode();
                }
                return(hashCode);
            }
        }
        /// <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 (Id != null)
                {
                    hashCode = hashCode * 59 + Id.GetHashCode();
                }
                if (ProgramId != null)
                {
                    hashCode = hashCode * 59 + ProgramId.GetHashCode();
                }
                if (PipelineId != null)
                {
                    hashCode = hashCode * 59 + PipelineId.GetHashCode();
                }
                if (ArtifactsVersion != null)
                {
                    hashCode = hashCode * 59 + ArtifactsVersion.GetHashCode();
                }
                if (User != null)
                {
                    hashCode = hashCode * 59 + User.GetHashCode();
                }

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

                hashCode = hashCode * 59 + Trigger.GetHashCode();
                if (CreatedAt != null)
                {
                    hashCode = hashCode * 59 + CreatedAt.GetHashCode();
                }
                if (UpdatedAt != null)
                {
                    hashCode = hashCode * 59 + UpdatedAt.GetHashCode();
                }
                if (FinishedAt != null)
                {
                    hashCode = hashCode * 59 + FinishedAt.GetHashCode();
                }
                if (Embedded != null)
                {
                    hashCode = hashCode * 59 + Embedded.GetHashCode();
                }
                if (Links != null)
                {
                    hashCode = hashCode * 59 + Links.GetHashCode();
                }
                return(hashCode);
            }
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (FinishedAt != null ? FinishedAt.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Message != null ? Message.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RequestedOperation != null ? RequestedOperation.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Phase != null ? Phase.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (RetryCount != null ? RetryCount.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StartedAt != null ? StartedAt.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SyncResult != null ? SyncResult.GetHashCode() : 0);
         return(hashCode);
     }
 }
        /// <summary>
        /// Returns true if PipelineExecution instances are equal
        /// </summary>
        /// <param name="other">Instance of PipelineExecution to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PipelineExecution other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     ProgramId == other.ProgramId ||
                     ProgramId != null &&
                     ProgramId.Equals(other.ProgramId)
                 ) &&
                 (
                     PipelineId == other.PipelineId ||
                     PipelineId != null &&
                     PipelineId.Equals(other.PipelineId)
                 ) &&
                 (
                     ArtifactsVersion == other.ArtifactsVersion ||
                     ArtifactsVersion != null &&
                     ArtifactsVersion.Equals(other.ArtifactsVersion)
                 ) &&
                 (
                     User == other.User ||
                     User != null &&
                     User.Equals(other.User)
                 ) &&
                 (
                     Status == other.Status ||

                     Status.Equals(other.Status)
                 ) &&
                 (
                     Trigger == other.Trigger ||

                     Trigger.Equals(other.Trigger)
                 ) &&
                 (
                     CreatedAt == other.CreatedAt ||
                     CreatedAt != null &&
                     CreatedAt.Equals(other.CreatedAt)
                 ) &&
                 (
                     UpdatedAt == other.UpdatedAt ||
                     UpdatedAt != null &&
                     UpdatedAt.Equals(other.UpdatedAt)
                 ) &&
                 (
                     FinishedAt == other.FinishedAt ||
                     FinishedAt != null &&
                     FinishedAt.Equals(other.FinishedAt)
                 ) &&
                 (
                     Embedded == other.Embedded ||
                     Embedded != null &&
                     Embedded.Equals(other.Embedded)
                 ) &&
                 (
                     Links == other.Links ||
                     Links != null &&
                     Links.Equals(other.Links)
                 ));
        }
Example #5
0
 private void IncrementTotalSeconds()
 {
     TotalSeconds += (int)FinishedAt.Subtract(StartedAt).TotalSeconds;
 }
Example #6
0
        /// <summary>
        /// Returns true if PipelineExecutionStepState instances are equal
        /// </summary>
        /// <param name="other">Instance of PipelineExecutionStepState to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PipelineExecutionStepState other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     StepId == other.StepId ||
                     StepId != null &&
                     StepId.Equals(other.StepId)
                 ) &&
                 (
                     PhaseId == other.PhaseId ||
                     PhaseId != null &&
                     PhaseId.Equals(other.PhaseId)
                 ) &&
                 (
                     Action == other.Action ||
                     Action != null &&
                     Action.Equals(other.Action)
                 ) &&
                 (
                     Repository == other.Repository ||
                     Repository != null &&
                     Repository.Equals(other.Repository)
                 ) &&
                 (
                     Branch == other.Branch ||
                     Branch != null &&
                     Branch.Equals(other.Branch)
                 ) &&
                 (
                     Environment == other.Environment ||
                     Environment != null &&
                     Environment.Equals(other.Environment)
                 ) &&
                 (
                     EnvironmentType == other.EnvironmentType ||
                     EnvironmentType != null &&
                     EnvironmentType.Equals(other.EnvironmentType)
                 ) &&
                 (
                     StartedAt == other.StartedAt ||
                     StartedAt != null &&
                     StartedAt.Equals(other.StartedAt)
                 ) &&
                 (
                     FinishedAt == other.FinishedAt ||
                     FinishedAt != null &&
                     FinishedAt.Equals(other.FinishedAt)
                 ) &&
                 (
                     Details == other.Details ||
                     Details != null &&
                     other.Details != null &&
                     Details.SequenceEqual(other.Details)
                 ) &&
                 (
                     Status == other.Status ||

                     Status.Equals(other.Status)
                 ) &&
                 (
                     Links == other.Links ||
                     Links != null &&
                     Links.Equals(other.Links)
                 ));
        }
Example #7
0
 public override string ToString()
 {
     return($"{Id} - {Name} {CreatedAt.ToShortDateString()} - {FinishedAt.ToShortDateString()}");
 }