public void TestProvidedMethods() { var i1 = Guid.NewGuid(); var i2 = Guid.NewGuid(); var c1 = new CorrelationId(i1); var c2 = new CorrelationId(i2); Assert.AreEqual(i1.CompareTo(i2), c1.CompareTo(c2)); // Compare correlation id and correlation id Assert.AreEqual(i1.CompareTo(i2), c1.CompareTo(i2)); // Compare correlation id and Guid Assert.AreEqual(i1.CompareTo((object)i2), c1.CompareTo((object)c2)); // Compare correlation id and object cid Assert.AreEqual(i1.CompareTo((object)i2), c1.CompareTo((object)i2)); // Compare correlation id and object Guid Assert.IsTrue(c1.Equals(new CorrelationId(i1))); // Equals correlation id and correlation id Assert.IsFalse(c1.Equals(new CorrelationId(i2))); // Not equals correlation id and correlation id Assert.IsTrue(c1.Equals((object)new CorrelationId(i1))); // Equals correlation id and object correlation id Assert.IsFalse(c1.Equals((object)new CorrelationId(i2))); // Not equals correlation id and object correlation id Assert.IsTrue(c1.Equals(i1)); // Equals correlation id and Guid Assert.IsFalse(c1.Equals(i2)); // Not equals correlation id and Guid Assert.IsFalse(c1.Equals((object)i1)); // Not equals correlation id and object Guid Assert.IsFalse(c1.Equals((object)i2)); // Not equals correlation id and object Guid Assert.AreEqual(i1.GetHashCode(), c1.GetHashCode()); // GetHashCode Assert.AreNotEqual(i2.GetHashCode(), c1.GetHashCode()); Assert.AreEqual(c1.GetHashCode(), c1.GetHashCode()); Assert.AreNotEqual(c2.GetHashCode(), c1.GetHashCode()); CollectionAssert.AreEqual(i1.ToByteArray(), c1.ToByteArray()); // To byte array CollectionAssert.AreNotEqual(i2.ToByteArray(), c1.ToByteArray()); CollectionAssert.AreEqual(i2.ToByteArray(), c2.ToByteArray()); CollectionAssert.AreNotEqual(i1.ToByteArray(), c2.ToByteArray()); Assert.AreEqual(i1.ToString(), c1.ToString()); // To string Assert.AreNotEqual(i2.ToString(), c1.ToString()); Assert.AreEqual(i2.ToString(), c2.ToString()); Assert.AreNotEqual(i1.ToString(), c2.ToString()); Assert.AreEqual(i1.ToString("N"), c1.ToString("N")); // To string with format Assert.AreNotEqual(i2.ToString("N"), c1.ToString("N")); Assert.AreEqual(i2.ToString("N"), c2.ToString("N")); Assert.AreNotEqual(i1.ToString("N"), c2.ToString("N")); var c = CultureInfo.CurrentCulture; Assert.AreEqual(i1.ToString("D", c), c1.ToString("D", c)); // To string with format and provider Assert.AreNotEqual(i2.ToString("D", c), c1.ToString("D", c)); Assert.AreEqual(i2.ToString("D", c), c2.ToString("D", c)); Assert.AreNotEqual(i1.ToString("D", c), c2.ToString("D", c)); }
public override int GetHashCode() { int hash = 1; if (Method.Length != 0) { hash ^= Method.GetHashCode(); } if (CorrelationId.Length != 0) { hash ^= CorrelationId.GetHashCode(); } if (ArgsEmpty != false) { hash ^= ArgsEmpty.GetHashCode(); } if (ArgsJson.Length != 0) { hash ^= ArgsJson.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (eventId_ != null) { hash ^= EventId.GetHashCode(); } if (source_ != null) { hash ^= Source.GetHashCode(); } if (correlationId_ != null) { hash ^= CorrelationId.GetHashCode(); } if (artifact_ != null) { hash ^= Artifact.GetHashCode(); } if (Occurred != 0L) { hash ^= Occurred.GetHashCode(); } if (originalContext_ != null) { hash ^= OriginalContext.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (source_ != null) { hash ^= Source.GetHashCode(); } if (Sequence != 0UL) { hash ^= Sequence.GetHashCode(); } if (id_ != null) { hash ^= Id.GetHashCode(); } if (TimeStamp != 0L) { hash ^= TimeStamp.GetHashCode(); } if (correlationId_ != null) { hash ^= CorrelationId.GetHashCode(); } hash ^= events_.GetHashCode(); return(hash); }
/// <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 (BlobName != null) { hashCode = hashCode * 59 + BlobName.GetHashCode(); } if (ContainerName != null) { hashCode = hashCode * 59 + ContainerName.GetHashCode(); } if (CorrelationId != null) { hashCode = hashCode * 59 + CorrelationId.GetHashCode(); } if (HostName != null) { hashCode = hashCode * 59 + HostName.GetHashCode(); } if (SasToken != null) { hashCode = hashCode * 59 + SasToken.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { int hash = 1; if (application_ != null) { hash ^= Application.GetHashCode(); } if (boundedContext_ != null) { hash ^= BoundedContext.GetHashCode(); } if (tenant_ != null) { hash ^= Tenant.GetHashCode(); } if (correlationId_ != null) { hash ^= CorrelationId.GetHashCode(); } if (Environment.Length != 0) { hash ^= Environment.GetHashCode(); } hash ^= claims_.GetHashCode(); if (Culture.Length != 0) { hash ^= Culture.GetHashCode(); } return(hash); }
/// <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 (Status != null) { hashCode = hashCode * 59 + Status.GetHashCode(); } if (CorrelationId != null) { hashCode = hashCode * 59 + CorrelationId.GetHashCode(); } if (Timestamp != null) { hashCode = hashCode * 59 + Timestamp.GetHashCode(); } if (Error != null) { hashCode = hashCode * 59 + Error.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { unchecked { return(((CorrelationId != null ? CorrelationId.GetHashCode() : 0) * 397) ^ (Message != null ? Message.GetHashCode() : 0)); } }
public override int GetHashCode() { var prime = 31; var result = 1; result = (prime * result) + ((AppId == null) ? 0 : AppId.GetHashCode()); result = (prime * result) + ((ClusterId == null) ? 0 : ClusterId.GetHashCode()); result = (prime * result) + ((ContentEncoding == null) ? 0 : ContentEncoding.GetHashCode()); result = (prime * result) + (int)(ContentLength ^ (ContentLength >> INT_MASK)); result = (prime * result) + ((ContentType == null) ? 0 : ContentType.GetHashCode()); result = (prime * result) + ((CorrelationId == null) ? 0 : CorrelationId.GetHashCode()); result = (prime * result) + ((DeliveryMode == null) ? 0 : DeliveryMode.GetHashCode()); result = (prime * result) + (int)(DeliveryTag ^ (DeliveryTag >> INT_MASK)); result = (prime * result) + ((Expiration == null) ? 0 : Expiration.GetHashCode()); result = (prime * result) + Headers.GetHashCode(); result = (prime * result) + ((MessageCount == null) ? 0 : MessageCount.GetHashCode()); result = (prime * result) + ((MessageId == null) ? 0 : MessageId.GetHashCode()); result = (prime * result) + ((Priority == null) ? 0 : Priority.GetHashCode()); result = (prime * result) + ((ReceivedExchange == null) ? 0 : ReceivedExchange.GetHashCode()); result = (prime * result) + ((ReceivedRoutingKey == null) ? 0 : ReceivedRoutingKey.GetHashCode()); result = (prime * result) + ((Redelivered == null) ? 0 : Redelivered.GetHashCode()); result = (prime * result) + ((ReplyTo == null) ? 0 : ReplyTo.GetHashCode()); result = (prime * result) + ((Timestamp == null) ? 0 : Timestamp.GetHashCode()); result = (prime * result) + ((Type == null) ? 0 : Type.GetHashCode()); result = (prime * result) + ((UserId == null) ? 0 : UserId.GetHashCode()); return(result); }
public override int GetHashCode() { int result = EndpointUri.GetHashCode(); result = 29 * result + MessageName.GetHashCode(); result = 29 * result + CorrelationId.GetHashCode(); return(result); }
public override int GetHashCode() { unchecked { int result = CorrelationId.GetHashCode(); result = (result * 397) ^ (ControlUri != null ? ControlUri.GetHashCode() : 0); result = (result * 397) ^ (DataUri != null ? DataUri.GetHashCode() : 0); return(result); } }
public void CorrelationId_Be_Equal_When_Ids_Are_Equal() { var baseBytes = ByteUtil.GenerateRandomByteArray(CorrelationId.GuidByteLength); var id1 = new CorrelationId(baseBytes); var id2 = new CorrelationId(baseBytes); id1.GetHashCode().Should().Be(id2.GetHashCode()); id1.Equals(id2).Should().BeTrue(); (id1 == id2).Should().BeTrue(); }
/// <inheritdoc/> public override int GetHashCode() { int hash = 13; unchecked { hash = (hash * 7) + CorrelationId?.GetHashCode() ?? 0; hash = (hash * 7) + MessageId?.GetHashCode() ?? 0; hash = (hash * 7) + SessionId?.GetHashCode() ?? 0; } return(hash); }
public override int GetHashCode() { unchecked { var hashCode = CorrelationId != null?CorrelationId.GetHashCode() : 0; hashCode = (hashCode * 397) ^ NumberOfTrades; hashCode = (hashCode * 397) ^ Limit; hashCode = (hashCode * 397) ^ (TradeID != null ? TradeID.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Value; return(hashCode); } }
/// <inheritdoc /> public override int GetHashCode() { unchecked { // Choose large primes to avoid hashing collisions const int HashingBase = (int)2166136261; const int HashingMultiplier = 16777619; int hash = HashingBase; hash = (hash * HashingMultiplier) ^ (EventId is object?EventId.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (CorrelationId is object?CorrelationId.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (EventName is object?EventName.GetHashCode() : 0); return(hash); } }
public override int GetHashCode() { unchecked { int result = LogPosition.GetHashCode(); result = (result * 397) ^ Flags.GetHashCode(); result = (result * 397) ^ TransactionPosition.GetHashCode(); result = (result * 397) ^ TransactionOffset; result = (result * 397) ^ ExpectedVersion.GetHashCode(); result = (result * 397) ^ EventStreamId.GetHashCode(); result = (result * 397) ^ EventId.GetHashCode(); result = (result * 397) ^ CorrelationId.GetHashCode(); result = (result * 397) ^ TimeStamp.GetHashCode(); result = (result * 397) ^ EventType.GetHashCode(); result = (result * 397) ^ Data.GetHashCode(); result = (result * 397) ^ Metadata.GetHashCode(); return(result); } }
public override int GetHashCode() { int hash = 1; if (MessageType != 0) { hash ^= MessageType.GetHashCode(); } if (CorrelationId.Length != 0) { hash ^= CorrelationId.GetHashCode(); } if (Content.Length != 0) { hash ^= Content.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { unchecked // overflow is fine, just wrap { var hash = 17; hash *= 23 + LogLevel.GetHashCode(); hash *= 23 + (EnvironmentName != null ? EnvironmentName.GetHashCode() : 0); hash *= 23 + (ClientId.HasValue ? ClientId.GetHashCode() : 0); hash *= 23 + (ClientVersion != null ? ClientVersion.GetHashCode() : 0); hash *= 23 + (MachineName != null ? MachineName.GetHashCode() : 0); hash *= 23 + (TenantId.HasValue ? TenantId.GetHashCode() : 0); hash *= 23 + (UserId.HasValue ? UserId.GetHashCode() : 0); hash *= 23 + (UserName != null ? UserName.GetHashCode() : 0); hash *= 23 + (SessionId.HasValue ? SessionId.GetHashCode() : 0); hash *= 23 + (DeviceId.HasValue ? DeviceId.GetHashCode() : 0); hash *= 23 + (CorrelationId.HasValue ? CorrelationId.GetHashCode() : 0); hash *= 23 + (Source != null ? Source.GetHashCode() : 0); hash *= 23 + (Message != null ? Message.GetHashCode() : 0); hash *= 23 + (Callstack != null ? Callstack.GetHashCode() : 0); return(hash); } }
public override int GetHashCode() { int hash = 1; if (Category.Length != 0) { hash ^= Category.GetHashCode(); } if (Code.Length != 0) { hash ^= Code.GetHashCode(); } if (CorrelationId.Length != 0) { hash ^= CorrelationId.GetHashCode(); } if (Status != 0) { hash ^= Status.GetHashCode(); } if (Message.Length != 0) { hash ^= Message.GetHashCode(); } if (Cause.Length != 0) { hash ^= Cause.GetHashCode(); } if (StackTrace.Length != 0) { hash ^= StackTrace.GetHashCode(); } hash ^= Details.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int result = 17; unchecked { if (Parameters != null) { result = (result * 31) + Parameters.GetHashCode(); } result = (result * 31) + StartTime.GetHashCode(); result = (result * 31) + EndTime.GetHashCode(); if (CorrelationId != null) { result = (result * 31) + CorrelationId.GetHashCode(); } if (Machine != null) { result = (result * 31) + Machine.GetHashCode(); } if (Account != null) { result = (result * 31) + Account.GetHashCode(); } result = (result * 31) + ProcessId.GetHashCode(); if (FileName != null) { result = (result * 31) + FileName.GetHashCode(); } if (WorkingDirectory != null) { result = (result * 31) + WorkingDirectory.GetHashCode(); } if (EnvironmentVariables != null) { // Use xor for dictionaries to be order-independent. int xor_0 = 0; foreach (var value_0 in EnvironmentVariables) { xor_0 ^= value_0.Key.GetHashCode(); if (value_0.Value != null) { xor_0 ^= value_0.Value.GetHashCode(); } } result = (result * 31) + xor_0; } if (Properties != null) { result = (result * 31) + Properties.GetHashCode(); } if (Tags != null) { foreach (var value_1 in Tags) { result = result * 31; if (value_1 != null) { result = (result * 31) + value_1.GetHashCode(); } } } } return(result); }
public override int GetHashCode() { int result = 17; unchecked { if (Tool != null) { result = (result * 31) + Tool.GetHashCode(); } if (Invocation != null) { result = (result * 31) + Invocation.GetHashCode(); } if (Files != null) { // Use xor for dictionaries to be order-independent. int xor_0 = 0; foreach (var value_0 in Files) { xor_0 ^= value_0.Key.GetHashCode(); if (value_0.Value != null) { xor_0 ^= value_0.Value.GetHashCode(); } } result = (result * 31) + xor_0; } if (Results != null) { foreach (var value_1 in Results) { result = result * 31; if (value_1 != null) { result = (result * 31) + value_1.GetHashCode(); } } } if (Rules != null) { // Use xor for dictionaries to be order-independent. int xor_1 = 0; foreach (var value_2 in Rules) { xor_1 ^= value_2.Key.GetHashCode(); if (value_2.Value != null) { xor_1 ^= value_2.Value.GetHashCode(); } } result = (result * 31) + xor_1; } result = (result * 31) + StartTime.GetHashCode(); result = (result * 31) + EndTime.GetHashCode(); if (CorrelationId != null) { result = (result * 31) + CorrelationId.GetHashCode(); } if (Architecture != null) { result = (result * 31) + Architecture.GetHashCode(); } if (Properties != null) { // Use xor for dictionaries to be order-independent. int xor_2 = 0; foreach (var value_3 in Properties) { xor_2 ^= value_3.Key.GetHashCode(); if (value_3.Value != null) { xor_2 ^= value_3.Value.GetHashCode(); } } result = (result * 31) + xor_2; } if (Tags != null) { foreach (var value_4 in Tags) { result = result * 31; if (value_4 != null) { result = (result * 31) + value_4.GetHashCode(); } } } } return(result); }
/// <inheritdoc /> public override int GetHashCode() { unchecked { // Choose large primes to avoid hashing collisions const int HashingBase = (int)2166136261; const int HashingMultiplier = 16777619; int hash = HashingBase; hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, EventId) ? EventId.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, CorrelationId) ? CorrelationId.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, EventName) ? EventName.GetHashCode() : 0); return(hash); } }