private System.Exception ProvideException(PayloadSize payloadSize) { const int totalExceptionFramesBaseline = 3; int multiplier = 1; switch (payloadSize) { case PayloadSize.Small: multiplier = 1; break; case PayloadSize.Medium: multiplier = 1 * Constants.SmallToMediumExceptionCallStackDepthMultiplier; break; case PayloadSize.Large: multiplier = 1 * Constants.SmallToMediumExceptionCallStackDepthMultiplier * Constants.MediumToLargeExceptionCallStackDepthMultiplier; break; default: Assumption.FailValidation("Unexpected value!", nameof(payloadSize)); break; } return(ExceptionSimulator.GetExceptionWith(multiplier * totalExceptionFramesBaseline)); }
private string ProvideMessage(PayloadSize payloadSize) { string smallMessage = @"Small message 1234 56789! "; StringBuilder result = new StringBuilder(smallMessage); int multiplier = 1; switch (payloadSize) { case PayloadSize.Small: multiplier = 1; break; case PayloadSize.Medium: multiplier = 1 * Constants.SmallToMediumMessageMultiplier; break; case PayloadSize.Large: multiplier = 1 * Constants.SmallToMediumMessageMultiplier * Constants.MediumToLargeMessageMultiplier; break; default: Assumption.FailValidation("Unexpected value!", nameof(payloadSize)); break; } int counter = 0; while (++counter < multiplier) { result.AppendLine(smallMessage); } return(result.ToString()); }
private void EvaluateUsing(PayloadSize theClassifier, ClassificationDeclaration classificationDeclaration) { classificationDeclaration.PayloadSize = theClassifier; foreach (var classifier in EnumUtil.GetAllValues <PayloadType>()) { EvaluateUsing(classifier, classificationDeclaration); } }
public override int GetHashCode() { int hash = 1; if (ReceiverId.Length != 0) { hash ^= ReceiverId.GetHashCode(); } if (TechnicalMessageType.Length != 0) { hash ^= TechnicalMessageType.GetHashCode(); } if (TeamSetContextId.Length != 0) { hash ^= TeamSetContextId.GetHashCode(); } if (chunkContext_ != null) { hash ^= ChunkContext.GetHashCode(); } if (PayloadSize != 0L) { hash ^= PayloadSize.GetHashCode(); } if (sentTimestamp_ != null) { hash ^= SentTimestamp.GetHashCode(); } if (SequenceNumber != 0L) { hash ^= SequenceNumber.GetHashCode(); } if (SenderId.Length != 0) { hash ^= SenderId.GetHashCode(); } if (createdAt_ != null) { hash ^= CreatedAt.GetHashCode(); } if (MessageId.Length != 0) { hash ^= MessageId.GetHashCode(); } if (metadata_ != null) { hash ^= Metadata.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public static PerformanceTimer TimeIt(Operation operation, PayloadSize payloadSize) { IClassification classification = Classification.MatchClassification(operation, payloadSize); return(PerformanceTimer.StartNew(PerformanceMonitor.Instance, classification)); }