public void IsEquivalentToDetectsWhenOneTypedSystemPropertyIsNull() { var body = new byte[] { 0x22, 0x44, 0x88 }; var firstEvent = new MockEventData((byte[])body.Clone(), partitionKey: null); var secondEvent = new MockEventData((byte[])body.Clone(), partitionKey: "trackOne"); Assert.That(firstEvent.IsEquivalentTo(secondEvent, true), Is.False); }
public void IsEquivalentToDetectsDifferentTypedSystemProperties() { var body = new byte[] { 0x22, 0x44, 0x88 }; var firstEvent = new MockEventData((byte[])body.Clone(), offset: 1); var secondEvent = new MockEventData((byte[])body.Clone(), offset: 2); Assert.That(firstEvent.IsEquivalentTo(secondEvent, true), Is.False); }
public void IsEquivalentToIgnoresTypedSystemPropertiesByDefault() { var body = new byte[] { 0x22, 0x44, 0x88 }; var firstEvent = new MockEventData((byte[])body.Clone(), partitionKey: "1"); var secondEvent = new MockEventData((byte[])body.Clone(), partitionKey: "2"); Assert.That(firstEvent.IsEquivalentTo(secondEvent), Is.True); }
public void IsEquivalentToDetectsWhenOnePropertySetIsNull() { var body = new byte[] { 0x22, 0x44, 0x88 }; var firstEvent = new MockEventData((byte[])body.Clone(), properties: null); var secondEvent = new MockEventData((byte[])body.Clone()); secondEvent.Properties["test"] = "trackTwo"; Assert.That(firstEvent.IsEquivalentTo(secondEvent), Is.False); }
public void IsEquivalentToDetectsNullArgument() { var firstEvent = new MockEventData( eventBody: new byte[] { 0x22, 0x44, 0x88 }, offset: 1, partitionKey: "hello", systemProperties: new Dictionary <string, object> { { "test", new object() } }); Assert.That(firstEvent.IsEquivalentTo((EventData)null), Is.False); }
public void IsEquivalentToDetectsDifferentMappedSystemProperties() { var body = new byte[] { 0x22, 0x44, 0x88 }; var firstSystemProperties = new Dictionary <string, object>(); var secondSystemProperties = new Dictionary <string, object>(); var firstEvent = new MockEventData((byte[])body.Clone(), systemProperties: firstSystemProperties); var secondEvent = new MockEventData((byte[])body.Clone(), systemProperties: secondSystemProperties); firstSystemProperties[nameof(IsEquivalentToDetectsDifferentMappedSystemProperties)] = true; secondSystemProperties[nameof(IsEquivalentToDetectsDifferentMappedSystemProperties)] = false; Assert.That(firstEvent.IsEquivalentTo(secondEvent, true), Is.False); }
public void IsEquivalentToDetectsDifferentDifferentPartitionKey() { var firstEvent = new MockEventData( eventBody: new byte[] { 0x22, 0x44 }, offset: 1, partitionKey: "hello", systemProperties: new Dictionary <string, object> { { "test", new object() } }); var secondEvent = new MockEventData( eventBody: new byte[] { 0x22, 0x44 }, offset: 1, partitionKey: "goodbye", systemProperties: new Dictionary <string, object> { { "test", new object() } }); Assert.That(firstEvent.IsEquivalentTo(secondEvent, true), Is.False); }
public void IsEquivalentToDetectsEqualEventsWithoutPartitionMetrics() { var body = new byte[] { 0x22, 0x44, 0x88 }; var firstEvent = new MockEventData( eventBody: (byte[])body.Clone(), offset: 1, partitionKey: "hello", systemProperties: new Dictionary <string, object> { { "test", new object() } }); var secondEvent = new MockEventData( eventBody: (byte[])body.Clone(), offset: 1, partitionKey: "hello", systemProperties: new Dictionary <string, object> { { "test", new object() } }); Assert.That(firstEvent.IsEquivalentTo(secondEvent), Is.True); }