コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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);
        }