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.Text.RegularExpressions;
35 using NUnit.Framework;
37 namespace MonoTests.Mono.Messaging
40 public class QueueReferenceTest
45 QueueReference qr1 = new QueueReference ("abc", "def", false);
46 QueueReference qr2 = new QueueReference ("abc", "def", false);
47 //Assert.IsTrue(qr1.Equals(qr2), "QueueReferences should be equal");
48 Assert.AreEqual (qr1, qr2, "QueueReferences should be equal");
54 string[] s = @".\def\ghi".Split (new char[] { '\\' }, 3);
55 Assert.AreEqual (3, s.Length, "Fail");
56 Assert.AreEqual (".", s[0], "Fail");
58 QueueReference qr0 = QueueReference.Parse (@"\\host\private$\myqueue");
59 Assert.AreEqual ("host", qr0.Host);
60 Assert.AreEqual (true, qr0.IsPrivate);
61 Assert.AreEqual (@"private$\myqueue", qr0.Queue);
63 QueueReference qr1 = QueueReference.Parse (@"\\host\myqueue");
64 Assert.AreEqual ("host", qr1.Host);
65 Assert.AreEqual (false, qr1.IsPrivate);
66 Assert.AreEqual ("myqueue", qr1.Queue);
68 QueueReference qr2 = QueueReference.Parse ("myqueue");
69 Assert.AreEqual ("localhost", qr2.Host);
70 Assert.AreEqual (false, qr2.IsPrivate);
71 Assert.AreEqual ("myqueue", qr2.Queue);
75 public void StringLeadingChars ()
77 Assert.AreEqual (@"asdfb\asdfasd",
78 QueueReference.RemoveLeadingSlashes (@"\\asdfb\asdfasd"),
79 "Failed to removed slashes");