Пример #1
0
        private void TestBasicPropertiesNoneClone(BasicProperties bp)
        {
            // Do not set any member and clone
            BasicProperties bpClone = bp.Clone() as BasicProperties;

            // Set members in source object
            bp.ContentType     = "foo_1";
            bp.ContentEncoding = "foo_2";
            bp.Headers         = new Dictionary <string, object>
            {
                { "foo_3", "foo_4" },
                { "foo_5", "foo_6" }
            };
            bp.DeliveryMode = 2;
            // Persistent also changes DeliveryMode's value to 2
            bp.Persistent    = true;
            bp.Priority      = 12;
            bp.CorrelationId = "foo_7";
            bp.ReplyTo       = "foo_8";
            bp.Expiration    = "foo_9";
            bp.MessageId     = "foo_10";
            bp.Timestamp     = new AmqpTimestamp(123);
            bp.Type          = "foo_11";
            bp.UserId        = "foo_12";
            bp.AppId         = "foo_13";
            bp.ClusterId     = "foo_14";

            // Check that no member is present in clone
            Assert.AreEqual(false, bpClone.IsContentTypePresent());
            Assert.AreEqual(false, bpClone.IsContentEncodingPresent());
            Assert.AreEqual(false, bpClone.IsHeadersPresent());
            Assert.AreEqual(false, bpClone.IsDeliveryModePresent());
            Assert.AreEqual(false, bpClone.IsPriorityPresent());
            Assert.AreEqual(false, bpClone.IsCorrelationIdPresent());
            Assert.AreEqual(false, bpClone.IsReplyToPresent());
            Assert.AreEqual(false, bpClone.IsExpirationPresent());
            Assert.AreEqual(false, bpClone.IsMessageIdPresent());
            Assert.AreEqual(false, bpClone.IsTimestampPresent());
            Assert.AreEqual(false, bpClone.IsTypePresent());
            Assert.AreEqual(false, bpClone.IsUserIdPresent());
            Assert.AreEqual(false, bpClone.IsAppIdPresent());
            Assert.AreEqual(false, bpClone.IsClusterIdPresent());
        }