|
45 | 45 | using RabbitMQ.Client;
|
46 | 46 | using RabbitMQ.Client.Impl;
|
47 | 47 |
|
48 |
| -[TestFixture] |
49 |
| -public class TestPropertiesClone |
| 48 | +namespace RabbitMQ.Client.Unit |
50 | 49 | {
|
51 |
| - [Test] |
52 |
| - public void TestBasicPropertiesCloneV0_9_1() |
| 50 | + [TestFixture] |
| 51 | + public class TestPropertiesClone |
53 | 52 | {
|
54 |
| - TestBasicPropertiesClone(new RabbitMQ.Client.Framing.BasicProperties()); |
55 |
| - } |
| 53 | + [Test] |
| 54 | + public void TestBasicPropertiesCloneV0_9_1() |
| 55 | + { |
| 56 | + TestBasicPropertiesClone(new RabbitMQ.Client.Framing.BasicProperties()); |
| 57 | + } |
56 | 58 |
|
57 |
| - [Test] |
58 |
| - public void TestBasicPropertiesNoneCloneV0_9_1() |
59 |
| - { |
60 |
| - TestBasicPropertiesNoneClone(new RabbitMQ.Client.Framing.BasicProperties()); |
61 |
| - } |
| 59 | + [Test] |
| 60 | + public void TestBasicPropertiesNoneCloneV0_9_1() |
| 61 | + { |
| 62 | + TestBasicPropertiesNoneClone(new RabbitMQ.Client.Framing.BasicProperties()); |
| 63 | + } |
62 | 64 |
|
63 |
| - private void TestBasicPropertiesClone(BasicProperties bp) |
64 |
| - { |
65 |
| - // Set initial values |
66 |
| - bp.ContentType = "foo_1"; |
67 |
| - bp.ContentEncoding = "foo_2"; |
68 |
| - bp.Headers = new Dictionary<string, object> |
| 65 | + private void TestBasicPropertiesClone(BasicProperties bp) |
| 66 | + { |
| 67 | + // Set initial values |
| 68 | + bp.ContentType = "foo_1"; |
| 69 | + bp.ContentEncoding = "foo_2"; |
| 70 | + bp.Headers = new Dictionary<string, object> |
69 | 71 | {
|
70 | 72 | { "foo_3", "foo_4" },
|
71 | 73 | { "foo_5", "foo_6" }
|
72 | 74 | };
|
73 |
| - bp.DeliveryMode = 2; |
74 |
| - // Persistent also changes DeliveryMode's value to 2 |
75 |
| - bp.Persistent = true; |
76 |
| - bp.Priority = 12; |
77 |
| - bp.CorrelationId = "foo_7"; |
78 |
| - bp.ReplyTo = "foo_8"; |
79 |
| - bp.Expiration = "foo_9"; |
80 |
| - bp.MessageId = "foo_10"; |
81 |
| - bp.Timestamp = new AmqpTimestamp(123); |
82 |
| - bp.Type = "foo_11"; |
83 |
| - bp.UserId = "foo_12"; |
84 |
| - bp.AppId = "foo_13"; |
85 |
| - bp.ClusterId = "foo_14"; |
| 75 | + bp.DeliveryMode = 2; |
| 76 | + // Persistent also changes DeliveryMode's value to 2 |
| 77 | + bp.Persistent = true; |
| 78 | + bp.Priority = 12; |
| 79 | + bp.CorrelationId = "foo_7"; |
| 80 | + bp.ReplyTo = "foo_8"; |
| 81 | + bp.Expiration = "foo_9"; |
| 82 | + bp.MessageId = "foo_10"; |
| 83 | + bp.Timestamp = new AmqpTimestamp(123); |
| 84 | + bp.Type = "foo_11"; |
| 85 | + bp.UserId = "foo_12"; |
| 86 | + bp.AppId = "foo_13"; |
| 87 | + bp.ClusterId = "foo_14"; |
86 | 88 |
|
87 |
| - // Clone |
88 |
| - BasicProperties bpClone = bp.Clone() as BasicProperties; |
| 89 | + // Clone |
| 90 | + BasicProperties bpClone = bp.Clone() as BasicProperties; |
89 | 91 |
|
90 |
| - // Change values in source object |
91 |
| - bp.ContentType = "foo_15"; |
92 |
| - bp.ContentEncoding = "foo_16"; |
93 |
| - bp.Headers.Remove("foo_3"); |
94 |
| - bp.Headers.Remove("foo_5"); |
95 |
| - bp.Headers.Add("foo_17", "foo_18"); |
96 |
| - bp.Headers.Add("foo_19", "foo_20"); |
97 |
| - bp.DeliveryMode = 1; |
98 |
| - // Persistent also changes DeliveryMode's value to 1 |
99 |
| - bp.Persistent = false; |
100 |
| - bp.Priority = 23; |
101 |
| - bp.CorrelationId = "foo_21"; |
102 |
| - bp.ReplyTo = "foo_22"; |
103 |
| - bp.Expiration = "foo_23"; |
104 |
| - bp.MessageId = "foo_24"; |
105 |
| - bp.Timestamp = new AmqpTimestamp(234); |
106 |
| - bp.Type = "foo_25"; |
107 |
| - bp.UserId = "foo_26"; |
108 |
| - bp.AppId = "foo_27"; |
109 |
| - bp.ClusterId = "foo_28"; |
| 92 | + // Change values in source object |
| 93 | + bp.ContentType = "foo_15"; |
| 94 | + bp.ContentEncoding = "foo_16"; |
| 95 | + bp.Headers.Remove("foo_3"); |
| 96 | + bp.Headers.Remove("foo_5"); |
| 97 | + bp.Headers.Add("foo_17", "foo_18"); |
| 98 | + bp.Headers.Add("foo_19", "foo_20"); |
| 99 | + bp.DeliveryMode = 1; |
| 100 | + // Persistent also changes DeliveryMode's value to 1 |
| 101 | + bp.Persistent = false; |
| 102 | + bp.Priority = 23; |
| 103 | + bp.CorrelationId = "foo_21"; |
| 104 | + bp.ReplyTo = "foo_22"; |
| 105 | + bp.Expiration = "foo_23"; |
| 106 | + bp.MessageId = "foo_24"; |
| 107 | + bp.Timestamp = new AmqpTimestamp(234); |
| 108 | + bp.Type = "foo_25"; |
| 109 | + bp.UserId = "foo_26"; |
| 110 | + bp.AppId = "foo_27"; |
| 111 | + bp.ClusterId = "foo_28"; |
110 | 112 |
|
111 |
| - // Make sure values have not changed in clone |
112 |
| - Assert.AreEqual("foo_1", bpClone.ContentType); |
113 |
| - Assert.AreEqual("foo_2", bpClone.ContentEncoding); |
114 |
| - Assert.AreEqual(2, bpClone.Headers.Count); |
115 |
| - Assert.AreEqual(true, bpClone.Headers.ContainsKey("foo_3")); |
116 |
| - Assert.AreEqual("foo_4", bpClone.Headers["foo_3"]); |
117 |
| - Assert.AreEqual(true, bpClone.Headers.ContainsKey("foo_5")); |
118 |
| - Assert.AreEqual("foo_6", bpClone.Headers["foo_5"]); |
119 |
| - Assert.AreEqual(2, bpClone.DeliveryMode); |
120 |
| - Assert.AreEqual(true, bpClone.Persistent); |
121 |
| - Assert.AreEqual(12, bpClone.Priority); |
122 |
| - Assert.AreEqual("foo_7", bpClone.CorrelationId); |
123 |
| - Assert.AreEqual("foo_8", bpClone.ReplyTo); |
124 |
| - Assert.AreEqual("foo_9", bpClone.Expiration); |
125 |
| - Assert.AreEqual("foo_10", bpClone.MessageId); |
126 |
| - Assert.AreEqual(new AmqpTimestamp(123), bpClone.Timestamp); |
127 |
| - Assert.AreEqual("foo_11", bpClone.Type); |
128 |
| - Assert.AreEqual("foo_12", bpClone.UserId); |
129 |
| - Assert.AreEqual("foo_13", bpClone.AppId); |
130 |
| - Assert.AreEqual("foo_14", bpClone.ClusterId); |
131 |
| - } |
| 113 | + // Make sure values have not changed in clone |
| 114 | + Assert.AreEqual("foo_1", bpClone.ContentType); |
| 115 | + Assert.AreEqual("foo_2", bpClone.ContentEncoding); |
| 116 | + Assert.AreEqual(2, bpClone.Headers.Count); |
| 117 | + Assert.AreEqual(true, bpClone.Headers.ContainsKey("foo_3")); |
| 118 | + Assert.AreEqual("foo_4", bpClone.Headers["foo_3"]); |
| 119 | + Assert.AreEqual(true, bpClone.Headers.ContainsKey("foo_5")); |
| 120 | + Assert.AreEqual("foo_6", bpClone.Headers["foo_5"]); |
| 121 | + Assert.AreEqual(2, bpClone.DeliveryMode); |
| 122 | + Assert.AreEqual(true, bpClone.Persistent); |
| 123 | + Assert.AreEqual(12, bpClone.Priority); |
| 124 | + Assert.AreEqual("foo_7", bpClone.CorrelationId); |
| 125 | + Assert.AreEqual("foo_8", bpClone.ReplyTo); |
| 126 | + Assert.AreEqual("foo_9", bpClone.Expiration); |
| 127 | + Assert.AreEqual("foo_10", bpClone.MessageId); |
| 128 | + Assert.AreEqual(new AmqpTimestamp(123), bpClone.Timestamp); |
| 129 | + Assert.AreEqual("foo_11", bpClone.Type); |
| 130 | + Assert.AreEqual("foo_12", bpClone.UserId); |
| 131 | + Assert.AreEqual("foo_13", bpClone.AppId); |
| 132 | + Assert.AreEqual("foo_14", bpClone.ClusterId); |
| 133 | + } |
132 | 134 |
|
133 |
| - private void TestBasicPropertiesNoneClone(BasicProperties bp) |
134 |
| - { |
135 |
| - // Do not set any member and clone |
136 |
| - BasicProperties bpClone = bp.Clone() as BasicProperties; |
| 135 | + private void TestBasicPropertiesNoneClone(BasicProperties bp) |
| 136 | + { |
| 137 | + // Do not set any member and clone |
| 138 | + BasicProperties bpClone = bp.Clone() as BasicProperties; |
137 | 139 |
|
138 |
| - // Set members in source object |
139 |
| - bp.ContentType = "foo_1"; |
140 |
| - bp.ContentEncoding = "foo_2"; |
141 |
| - bp.Headers = new Dictionary<string, object> |
| 140 | + // Set members in source object |
| 141 | + bp.ContentType = "foo_1"; |
| 142 | + bp.ContentEncoding = "foo_2"; |
| 143 | + bp.Headers = new Dictionary<string, object> |
142 | 144 | {
|
143 | 145 | { "foo_3", "foo_4" },
|
144 | 146 | { "foo_5", "foo_6" }
|
145 | 147 | };
|
146 |
| - bp.DeliveryMode = 2; |
147 |
| - // Persistent also changes DeliveryMode's value to 2 |
148 |
| - bp.Persistent = true; |
149 |
| - bp.Priority = 12; |
150 |
| - bp.CorrelationId = "foo_7"; |
151 |
| - bp.ReplyTo = "foo_8"; |
152 |
| - bp.Expiration = "foo_9"; |
153 |
| - bp.MessageId = "foo_10"; |
154 |
| - bp.Timestamp = new AmqpTimestamp(123); |
155 |
| - bp.Type = "foo_11"; |
156 |
| - bp.UserId = "foo_12"; |
157 |
| - bp.AppId = "foo_13"; |
158 |
| - bp.ClusterId = "foo_14"; |
| 148 | + bp.DeliveryMode = 2; |
| 149 | + // Persistent also changes DeliveryMode's value to 2 |
| 150 | + bp.Persistent = true; |
| 151 | + bp.Priority = 12; |
| 152 | + bp.CorrelationId = "foo_7"; |
| 153 | + bp.ReplyTo = "foo_8"; |
| 154 | + bp.Expiration = "foo_9"; |
| 155 | + bp.MessageId = "foo_10"; |
| 156 | + bp.Timestamp = new AmqpTimestamp(123); |
| 157 | + bp.Type = "foo_11"; |
| 158 | + bp.UserId = "foo_12"; |
| 159 | + bp.AppId = "foo_13"; |
| 160 | + bp.ClusterId = "foo_14"; |
159 | 161 |
|
160 |
| - // Check that no member is present in clone |
161 |
| - Assert.AreEqual(false, bpClone.IsContentTypePresent()); |
162 |
| - Assert.AreEqual(false, bpClone.IsContentEncodingPresent()); |
163 |
| - Assert.AreEqual(false, bpClone.IsHeadersPresent()); |
164 |
| - Assert.AreEqual(false, bpClone.IsDeliveryModePresent()); |
165 |
| - Assert.AreEqual(false, bpClone.IsPriorityPresent()); |
166 |
| - Assert.AreEqual(false, bpClone.IsCorrelationIdPresent()); |
167 |
| - Assert.AreEqual(false, bpClone.IsReplyToPresent()); |
168 |
| - Assert.AreEqual(false, bpClone.IsExpirationPresent()); |
169 |
| - Assert.AreEqual(false, bpClone.IsMessageIdPresent()); |
170 |
| - Assert.AreEqual(false, bpClone.IsTimestampPresent()); |
171 |
| - Assert.AreEqual(false, bpClone.IsTypePresent()); |
172 |
| - Assert.AreEqual(false, bpClone.IsUserIdPresent()); |
173 |
| - Assert.AreEqual(false, bpClone.IsAppIdPresent()); |
174 |
| - Assert.AreEqual(false, bpClone.IsClusterIdPresent()); |
| 162 | + // Check that no member is present in clone |
| 163 | + Assert.AreEqual(false, bpClone.IsContentTypePresent()); |
| 164 | + Assert.AreEqual(false, bpClone.IsContentEncodingPresent()); |
| 165 | + Assert.AreEqual(false, bpClone.IsHeadersPresent()); |
| 166 | + Assert.AreEqual(false, bpClone.IsDeliveryModePresent()); |
| 167 | + Assert.AreEqual(false, bpClone.IsPriorityPresent()); |
| 168 | + Assert.AreEqual(false, bpClone.IsCorrelationIdPresent()); |
| 169 | + Assert.AreEqual(false, bpClone.IsReplyToPresent()); |
| 170 | + Assert.AreEqual(false, bpClone.IsExpirationPresent()); |
| 171 | + Assert.AreEqual(false, bpClone.IsMessageIdPresent()); |
| 172 | + Assert.AreEqual(false, bpClone.IsTimestampPresent()); |
| 173 | + Assert.AreEqual(false, bpClone.IsTypePresent()); |
| 174 | + Assert.AreEqual(false, bpClone.IsUserIdPresent()); |
| 175 | + Assert.AreEqual(false, bpClone.IsAppIdPresent()); |
| 176 | + Assert.AreEqual(false, bpClone.IsClusterIdPresent()); |
| 177 | + } |
175 | 178 | }
|
176 | 179 | }
|
0 commit comments