Пример #1
0
        public void ParseTest()
        {
            string commandLine = string.Empty;

            string[] expected = new string[] {};
            string[] actual;
            actual = CommandLineParser_Accessor.Parse(commandLine);
            CollectionAssert.AreEqual(expected, actual);

            commandLine = null;
            actual      = CommandLineParser_Accessor.Parse(commandLine);
            CollectionAssert.AreEqual(expected, actual);

            commandLine = "send";
            expected    = new string[] { "send" };
            actual      = CommandLineParser_Accessor.Parse(commandLine);
            CollectionAssert.AreEqual(expected, actual);

            commandLine = "send ";
            actual      = CommandLineParser_Accessor.Parse(commandLine);
            CollectionAssert.AreEqual(expected, actual);

            commandLine = "send  ?";
            expected    = new string[] { "send", "?" };
            actual      = CommandLineParser_Accessor.Parse(commandLine);
            CollectionAssert.AreEqual(expected, actual);

            commandLine = "send notapath ";
            expected    = new string[] { "send", "notapath" };
            actual      = CommandLineParser_Accessor.Parse(commandLine);
            CollectionAssert.AreEqual(expected, actual);

            commandLine = "send notapath text ";
            expected    = new string[] { "send", "notapath", "text" };
            actual      = CommandLineParser_Accessor.Parse(commandLine);
            CollectionAssert.AreEqual(expected, actual);

            commandLine = "send notapath text \"some text here\"";
            expected    = new string[] { "send", "notapath", "text", "some text here" };
            actual      = CommandLineParser_Accessor.Parse(commandLine);
            CollectionAssert.AreEqual(expected, actual);

            commandLine = "send notapath count 5 text \"some text here\"";
            expected    = new string[] { "send", "notapath", "count", "5", "text", "some text here" };
            actual      = CommandLineParser_Accessor.Parse(commandLine);
            CollectionAssert.AreEqual(expected, actual);

            commandLine = "send notapath count 5 text \"some text here\" path \"c:\\some test path\\and test\\folder\"";
            expected    = new string[] { "send", "notapath", "count", "5", "text", "some text here", "path", "c:\\some test path\\and test\\folder" };
            actual      = CommandLineParser_Accessor.Parse(commandLine);
            CollectionAssert.AreEqual(expected, actual);
        }
Пример #2
0
        //
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        string[] Parse(string commandline)
        {
            return(CommandLineParser_Accessor.Parse(commandline));
        }