public void JsonTypesShouldBeParsedAndReturnedAsIs()
        {
            var parseResult = _parser.Parse("TestCommand(true, 0.5, -1000000, \"this is ,simple string\"," +
                                            " \"and ,this \\\",is \\\"heavily,\\\"nested\\\"\\\" string\", [1,2,3])");

            Assert.IsTrue(parseResult.IsSuccess);
            Assert.AreEqual("TestCommand", parseResult.GetOrEmpty().Name);
            CollectionAssert.AreEquivalent(new[] {
                "true", "0.5", "-1000000", "\"this is ,simple string\"",
                "\"and ,this \\\",is \\\"heavily,\\\"nested\\\"\\\" string\"", "[1,2,3]"
            }, parseResult.GetOrEmpty().Args);
        }
Esempio n. 2
0
        private static StorageCommand GetCommand(ConsoleCommandParser consoleCommandParser, IConsolePrinter consolePrinter)
        {
            consolePrinter.PrintСommandWaitingIcon();
            string rowCommand = Console.ReadLine();

            if (string.IsNullOrWhiteSpace(rowCommand))
            {
                throw new ArgumentException("You have not entered a command.");
            }

            return(consoleCommandParser.Parse(rowCommand.ToLower().Trim()));
        }