2 // Mono.Messaging.RabbitMQ
5 // Michael Barker (mike@middlesoft.co.uk)
7 // (C) 2008 Michael Barker
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.Messaging;
33 using System.Reflection;
36 using SystemAcknowledgeTypes = System.Messaging.AcknowledgeTypes;
37 using SystemCryptographicProviderType = System.Messaging.CryptographicProviderType;
38 using SystemEncryptionAlgorithm = System.Messaging.EncryptionAlgorithm;
39 using SystemHashAlgorithm = System.Messaging.HashAlgorithm;
40 using SystemMessagePriority = System.Messaging.MessagePriority;
42 using NUnit.Framework;
44 namespace MonoTests.Mono.Messaging {
47 public class MessageBaseTest {
50 public void CheckDefaultValues ()
53 typeof (IMessage), typeof (object), typeof (IMessageFormatter)
56 ConstructorInfo ci = typeof (Message).GetConstructor (
57 BindingFlags.NonPublic | BindingFlags.Instance,
58 Type.DefaultBinder, types, new ParameterModifier[0]);
61 throw new Exception ("ConstructorInfo is null");
63 Message m = (Message) ci.Invoke (new object[] { new MessageBase (), null, null });
65 Assert.IsNull (m.Body, "Body default should be Null");
66 Assert.IsNull (m.Formatter, "Formatter default should null");
68 Assert.AreEqual (SystemAcknowledgeTypes.None,
70 "AcknowledgeType default should be None");
71 Assert.AreEqual (null, m.AdministrationQueue,
72 "AdministrationQueue default should be null");
73 Assert.AreEqual (0, m.AppSpecific, "AppSpecific default should be 0");
74 Assert.AreEqual (true, m.AttachSenderId, "AttachSenderId default should be true");
75 Assert.AreEqual ("Microsoft Base Cryptographic Provider, Ver. 1.0", m.AuthenticationProviderName,
76 "AuthenticationProviderName should default to \"Microsoft Base Cryptographic Provider, Ver. 1.0\"");
77 Assert.AreEqual (SystemCryptographicProviderType.RsaFull,
78 m.AuthenticationProviderType,
79 "AuthenticationProviderType should default to RsaFull");
80 Assert.AreEqual (null, m.BodyStream, "BodyStream should default to null");
81 Assert.AreEqual (Guid.Empty, m.ConnectorType, "ConnectorType should default to empty");
82 Assert.AreEqual (null, m.CorrelationId, "CorrelationId should default to null");
83 Assert.AreEqual (new byte[0], m.DestinationSymmetricKey,
84 "DestinationSymmetricKey should default to an empty array");
85 Assert.AreEqual (new byte[0], m.DigitalSignature,
86 "DigitalSignature default to an empty array");
87 Assert.AreEqual (SystemEncryptionAlgorithm.Rc2,
88 m.EncryptionAlgorithm,
89 "EncryptionAlgorithm should default to Rc2");
90 Assert.AreEqual (new byte[0], m.Extension,
91 "Extension should default to an empty array");
92 Assert.AreEqual (SystemHashAlgorithm.Sha, m.HashAlgorithm,
93 "HashAlgorithm should default to Sha");
94 Assert.AreEqual (Guid.Empty.ToString () + "\\0", m.Id, "Id should default to Guid.Empty");
95 Assert.AreEqual ("", m.Label, "Label should default to \"\"");
96 Assert.AreEqual (false, m.IsFirstInTransaction, "IsFirstInTransaction should default to false");
97 Assert.AreEqual (false, m.IsLastInTransaction, "IsLastInTransaction should default to false");
98 Assert.AreEqual (SystemMessagePriority.Normal, m.Priority,
99 "Priority should default to Normal");
100 Assert.AreEqual (false, m.Recoverable, "Recoverable should default to false");
101 Assert.AreEqual (null, m.ResponseQueue, "ResponseQueue should default to null");
102 //Assert.AreEqual (null, m.SecurityContext, "SecurityContext should default to null");
103 Assert.AreEqual (new byte[0], m.SenderCertificate,
104 "SenderCertificate should default to an empty array");
105 Assert.AreEqual (Message.InfiniteTimeout, m.TimeToBeReceived,
106 "TimeToBeReceived should default to InfiniteTimeout");
107 Assert.AreEqual (Message.InfiniteTimeout, m.TimeToReachQueue,
108 "TimeToReadQueue should default to InfiniteTimeout");
109 Assert.AreEqual (false, m.UseAuthentication,
110 "UseAuthentication should default to false");
111 Assert.AreEqual (false, m.UseDeadLetterQueue,
112 "UseDeadLetterQueue should default to false");
113 Assert.AreEqual (false, m.UseEncryption, "Encryption should default to false");
114 Assert.AreEqual (false, m.UseJournalQueue,
115 "UseJournalQueue should default to false");
116 Assert.AreEqual (false, m.UseTracing, "UseTracing should default to false");