public void DecodePurgeQueueTest() { string args = "purge"; CommandBaseEx actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNull(actual); args = "purge "; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNull(actual); args = "purge ?"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNull(actual); args = "purge /p notapath"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); Assert.AreEqual(((PurgeQueueCommandEx)actual).Path, ".\\private$\\notapath"); args = "purge /p FormatName:DIRECT=TCP:10.139.209.222\\private$\\notapath "; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); Assert.AreEqual("FormatName:DIRECT=TCP:10.139.209.222\\private$\\notapath", ((PurgeQueueCommandEx)actual).Path); args = "purge /p notapath garbage"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); }
public void DecodeListCommandTest() { string args = "list"; CommandBaseEx actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); args = "list "; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); args = "list ?"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNull(actual); args = "list /h 127.0.0.1"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); Assert.AreEqual(((ListQueuesCommand)actual).MachineName, "127.0.0.1"); args = "list /h localhost /u domain\\user /p password"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); Assert.AreEqual("localhost", ((ListQueuesCommand)actual).MachineName); Assert.AreEqual("password", ((ListQueuesCommand)actual).Password); Assert.AreEqual("domain", ((ListQueuesCommand)actual).Domain); Assert.AreEqual("user", ((ListQueuesCommand)actual).UserName); }
public void DecodeCreateQueueTest() { string args = "create"; CommandBaseEx actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNull(actual); args = "create "; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNull(actual); args = "create ?"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNull(actual); args = "create /p notapath"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); Assert.AreEqual(((CreateQueueCommandEx)actual).Path, ".\\private$\\notapath"); args = "create /p notapath "; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); Assert.AreEqual(((CreateQueueCommandEx)actual).Path, ".\\private$\\notapath"); Assert.IsFalse(((CreateQueueCommandEx)actual).Transactional); args = "create /p notapath asdf"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); args = "create /p notapath /t"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); Assert.AreEqual(((CreateQueueCommandEx)actual).Path, ".\\private$\\notapath"); Assert.IsTrue(((CreateQueueCommandEx)actual).Transactional); }
public void DecodePeekCommandTest() { string args = "peek"; CommandBaseEx actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNull(actual); args = "peek "; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNull(actual); args = "peek ?"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNull(actual); args = "peek /p notapath"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); Assert.AreEqual(".\\private$\\notapath", ((PeekQueueCommandEx)actual).Path); args = "peek /p notapath "; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); Assert.AreEqual(((PeekQueueCommandEx)actual).Path, ".\\private$\\notapath"); args = "peek /p notapath /c garbage"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNull(actual); args = "peek /p notapath /c 0"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); Assert.AreEqual((int?)null, ((PeekQueueCommandEx)actual).Count); args = "peek /p .\\private$\\notapath /c 10"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); Assert.AreEqual(".\\private$\\notapath", ((PeekQueueCommandEx)actual).Path); Assert.AreEqual(10, ((PeekQueueCommandEx)actual).Count); args = "peek /p FormatName:DIRECT=TCP:10.139.209.222\\private$\\notapath /c 0"; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); Assert.IsNotNull(actual); Assert.AreEqual(((PeekQueueCommandEx)actual).Path, "FormatName:DIRECT=TCP:10.139.209.222\\private$\\notapath"); Assert.AreEqual((int?)null, ((PeekQueueCommandEx)actual).Count); //Adding test to cover peek command failure on empty queue const string TEST_PEEK_QUEUE = ".\\private$\\test_peek_queue"; if (MessageQueue.Exists(TEST_PEEK_QUEUE)) { MessageQueue.Delete(TEST_PEEK_QUEUE); } MessageQueue.Create(TEST_PEEK_QUEUE); args = "peek /p " + TEST_PEEK_QUEUE; actual = CommandLineParser_Accessor.ParseQueueCommandEx(Parse(args)); CommandBaseEx.Run(actual); MessageQueue.Delete(TEST_PEEK_QUEUE); }