importing messaging-2008 branch to trunk, going on.
[mono.git] / mcs / class / Mono.Messaging / Test / Mono.Messaging / MessageBaseTest.cs
1 //
2 // Mono.Messaging.RabbitMQ
3 //
4 // Authors:
5 //        Michael Barker (mike@middlesoft.co.uk)
6 //
7 // (C) 2008 Michael Barker
8 //
9
10 //
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:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
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.
29 //
30
31 using System;
32 using System.Messaging;
33
34 using NUnit.Framework;
35
36 namespace MonoTests.Mono.Messaging {
37
38         [TestFixture]
39         public class MessageBaseTest {
40                 
41                 [Test]
42                 public void CheckDefaultValues ()
43                 {
44                         Message m = new Message ();
45                         Assert.IsNull (m.Body, "Body default should be Null");
46                         Assert.IsNull (m.Formatter, "Formatter default should null");
47                         
48                         Assert.AreEqual (System.Messaging.AcknowledgeTypes.None, 
49                                         m.AcknowledgeType, 
50                                         "AcknowledgeType default should be None");
51                         Assert.AreEqual (null, m.AdministrationQueue, 
52                                         "AdministrationQueue default should be null");
53                         Assert.AreEqual (0, m.AppSpecific, "AppSpecific default should be 0");
54                         Assert.AreEqual (true, m.AttachSenderId, "AttachSenderId default should be true");
55                         Assert.AreEqual ("", m.AuthenticationProviderName, 
56                                         "AuthenticationProviderName should default to \"\"");
57                         Assert.AreEqual (System.Messaging.CryptographicProviderType.RsaFull, 
58                                         m.AuthenticationProviderType, 
59                                         "AuthenticationProviderType should default to RsaFull");
60                         Assert.AreEqual (null, m.BodyStream, "BodyStream should default to null");
61                         Assert.AreEqual (Guid.Empty, m.ConnectorType, "ConnectorType should default to empty");
62                         Assert.AreEqual (null, m.CorrelationId, "CorrelationId should default to null");
63                         Assert.AreEqual (new byte[0], m.DestinationSymmetricKey, 
64                                         "DestinationSymmetricKey should default to an empty array");
65                         Assert.AreEqual (new byte[0], m.DigitalSignature,
66                                         "DigitalSignature default to an empty array");
67                         Assert.AreEqual (System.Messaging.EncryptionAlgorithm.Rc2,
68                                         m.EncryptionAlgorithm,
69                                         "EncryptionAlgorithm should default to Rc2");
70                         Assert.AreEqual (new byte[0], m.Extension, 
71                                         "Extension should default to an empty array");
72                         Assert.AreEqual (System.Messaging.HashAlgorithm.Sha, m.HashAlgorithm, 
73                                         "HashAlgorithm should default to Sha");
74                         Assert.AreEqual (Guid.Empty.ToString (), m.Id, "Id should default to Guid.Empty");
75                         Assert.AreEqual ("", m.Label, "Label should default to \"\"");
76                         Assert.AreEqual (false, m.IsFirstInTransaction, "IsFirstInTransaction should default to false");
77                         Assert.AreEqual (false, m.IsLastInTransaction, "IsLastInTransaction should default to false");
78                         Assert.AreEqual (MessagePriority.Normal, m.Priority,
79                                         "Priority should default to Normal");
80                         Assert.AreEqual (false, m.Recoverable, "Recoverable should default to false");
81                         Assert.AreEqual (null, m.ResponseQueue, "ResponseQueue should default to null");
82                         //Assert.AreEqual (null, m.SecurityContext, "SecurityContext should default to null");
83                         Assert.AreEqual (new byte[0], m.SenderCertificate, 
84                                         "SenderCertificate should default to an empty array");
85                         Assert.AreEqual (Message.InfiniteTimeout, m.TimeToBeReceived,
86                                         "TimeToBeReceived should default to InfiniteTimeout");
87                         Assert.AreEqual (Message.InfiniteTimeout, m.TimeToReachQueue,
88                                         "TimeToReadQueue should default to InfiniteTimeout");
89                         Assert.AreEqual (false, m.UseAuthentication, 
90                                         "UseAuthentication should default to false");
91                         Assert.AreEqual (false, m.UseDeadLetterQueue,
92                                         "UseDeadLetterQueue should default to false");
93                         Assert.AreEqual (false, m.UseEncryption, "Encryption should default to false");
94                         Assert.AreEqual (false, m.UseJournalQueue, 
95                                         "UseJournalQueue should default to false");
96                         Assert.AreEqual (false, m.UseTracing, "UseTracing should default to false");
97                 }
98                 
99         }
100 }