public virtual void TestMultiMessageIdCompareto()
        {
            // null
            var null1 = new MultiMessageId(null);
            var null2 = new MultiMessageId(null);

            Assert.Equal(0, null1.CompareTo(null2));

            // empty
            var empty1 = new MultiMessageId(new Dictionary <string, IMessageId>());
            var empty2 = new MultiMessageId(new Dictionary <string, IMessageId>());

            Assert.Equal(0, empty1.CompareTo(empty2));

            // null empty
            Assert.Equal(0, null1.CompareTo(empty2));
            Assert.Equal(0, empty2.CompareTo(null1));

            // 1 item
            var topic1     = "topicName1";
            var MessageId1 = new MessageId(123L, 345L, 567);
            var MessageId2 = new MessageId(123L, 345L, 567);
            var MessageId3 = new MessageId(345L, 456L, 567);

            var item1 = new MultiMessageId(new Dictionary <string, IMessageId> {
                { topic1, MessageId1 }
            });
            var item2 = new MultiMessageId(new Dictionary <string, IMessageId> {
                { topic1, MessageId2 }
            });

            Assert.Equal(0, item1.CompareTo(item2));

            // 1 item, empty not equal
            try
            {
                item1.CompareTo(null1);
                Assert.False(false, "should throw exception for not comparable");
            }
            catch (System.ArgumentException)
            {
                // expected
            }
            try
            {
                null1.CompareTo(item1);
                Assert.False(false, "should throw exception for not comparable");
            }
            catch (System.ArgumentException)
            {
                // expected
            }

            // key not equal
            var topic2 = "topicName2";
            var item3  = new MultiMessageId(new Dictionary <string, IMessageId> {
                { topic2, MessageId2 }
            });

            try
            {
                item1.CompareTo(item3);
                Assert.False(false, "should throw exception for not comparable");
            }
            catch (System.ArgumentException)
            {
                // expected
            }
            try
            {
                item3.CompareTo(item1);
                Assert.False(false, "should throw exception for not comparable");
            }
            catch (System.ArgumentException)
            {
                // expected
            }

            // value not equal
            var item4 = new MultiMessageId(new Dictionary <string, IMessageId> {
                { topic1, MessageId3 }
            });

            Assert.True(item1.CompareTo(item4) < 0);
            Assert.True(item4.CompareTo(item1) > 0);

            // key value not equal
            try
            {
                item3.CompareTo(item4);
                Assert.False(false, "should throw exception for not comparable");
            }
            catch (System.ArgumentException)
            {
                // expected
            }
            try
            {
                item4.CompareTo(item3);
                Assert.False(false, "should throw exception for not comparable");
            }
            catch (System.ArgumentException)
            {
                // expected
            }

            // 2 items
            IDictionary <string, IMessageId> map1 = new Dictionary <string, IMessageId>();
            IDictionary <string, IMessageId> map2 = new Dictionary <string, IMessageId>();

            map1[topic1] = MessageId1;
            map1[topic2] = MessageId2;
            map2[topic2] = MessageId2;
            map2[topic1] = MessageId1;

            var item5 = new MultiMessageId(map1);
            var item6 = new MultiMessageId(map2);

            Assert.True(item5.CompareTo(item6) == 0);

            try
            {
                item5.CompareTo(null1);
                Assert.False(false, "should throw exception for not comparable");
            }
            catch (System.ArgumentException)
            {
                // expected
            }

            try
            {
                item5.CompareTo(empty1);
                Assert.False(false, "should throw exception for not comparable");
            }
            catch (System.ArgumentException)
            {
                // expected
            }

            try
            {
                item5.CompareTo(item1);
                Assert.False(false, "should throw exception for not comparable");
            }
            catch (System.ArgumentException)
            {
                // expected
            }

            try
            {
                item5.CompareTo(item3);
                Assert.False(false, "should throw exception for not comparable");
            }
            catch (System.ArgumentException)
            {
                // expected
            }

            try
            {
                item5.CompareTo(item4);
                Assert.False(false, "should throw exception for not comparable");
            }
            catch (System.ArgumentException)
            {
                // expected
            }

            map2[topic1] = MessageId3;
            var item7 = new MultiMessageId(map2);

            Assert.True(item7.CompareTo(item5) > 0);
            Assert.True(item5.CompareTo(item7) < 0);

            IDictionary <string, IMessageId> map3 = new Dictionary <string, IMessageId>();

            map3[topic1] = MessageId3;
            map3[topic2] = MessageId3;
            var item8 = new MultiMessageId(map3);

            Assert.True(item8.CompareTo(item5) > 0);
            Assert.True(item8.CompareTo(item7) > 0);

            Assert.True(item5.CompareTo(item8) < 0);
            Assert.True(item7.CompareTo(item8) < 0);
        }
        public virtual void TestMultiMessageIdEqual()
        {
            // null
            var null1 = new MultiMessageId(null);
            var null2 = new MultiMessageId(null);

            Assert.Equal(null1, null2);

            // empty
            var empty1 = new MultiMessageId(new Dictionary <string, IMessageId>());
            var empty2 = new MultiMessageId(new Dictionary <string, IMessageId>());

            Assert.Equal(empty1, empty2);

            // null empty
            Assert.Equal(null1, empty2);
            Assert.Equal(empty2, null1);

            // 1 item
            var topic1     = "topicName1";
            var MessageId1 = new MessageId(123L, 345L, 567);
            var MessageId2 = new MessageId(123L, 345L, 567);
            var MessageId3 = new MessageId(345L, 456L, 567);

            var item1 = new MultiMessageId(new Dictionary <string, IMessageId> {
                { topic1, MessageId1 }
            });
            var item2 = new MultiMessageId(new Dictionary <string, IMessageId> {
                { topic1, MessageId2 }
            });

            Assert.Equal(item1, item2);

            // 1 item, empty not equal
            Assert.NotEqual(item1, null1);
            Assert.NotEqual(null1, item1);

            // key not equal
            var topic2 = "topicName2";
            var item3  = new MultiMessageId(new Dictionary <string, IMessageId> {
                { topic2, MessageId2 }
            });

            Assert.NotEqual(item1, item3);
            Assert.NotEqual(item3, item1);

            // value not equal
            var item4 = new MultiMessageId(new Dictionary <string, IMessageId> {
                { topic1, MessageId3 }
            });

            Assert.NotEqual(item1, item4);
            Assert.NotEqual(item4, item1);

            // key value not equal
            Assert.NotEqual(item3, item4);
            Assert.NotEqual(item4, item3);

            // 2 items
            IDictionary <string, IMessageId> map1 = new Dictionary <string, IMessageId>();
            IDictionary <string, IMessageId> map2 = new Dictionary <string, IMessageId>();

            map1[topic1] = MessageId1;
            map1[topic2] = MessageId2;
            map2[topic2] = MessageId2;
            map2[topic1] = MessageId1;

            var item5 = new MultiMessageId(map1);
            var item6 = new MultiMessageId(map2);

            Assert.Equal(item5, item6);

            Assert.NotEqual(item5, null1);
            Assert.NotEqual(item5, empty1);
            Assert.NotEqual(item5, item1);
            Assert.NotEqual(item5, item3);
            Assert.NotEqual(item5, item4);

            Assert.NotEqual(null1, item5);
            Assert.NotEqual(empty1, item5);
            Assert.NotEqual(item1, item5);
            Assert.NotEqual(item3, item5);
            Assert.NotEqual(item4, item5);

            map2[topic1] = MessageId3;
            var item7 = new MultiMessageId(map2);

            Assert.NotEqual(item5, item7);
            Assert.NotEqual(item7, item5);
        }