public void SplitArgumentsShouldSplitAtSpacesOutsideOfQuotes() { var expected = new string[] { "--port", "8080", "--endpoint", "127.0.0.1:8020", "--diag", "abc", "txt" }; var argument = "--port 8080 --endpoint 127.0.0.1:8020 --diag abc txt"; string[] argsArr = UnitTestClient.SplitArguments(argument); Assert.AreEqual(argsArr.Length, 7); CollectionAssert.AreEqual(argsArr, expected); }
public void SplitArgumentsShouldHonorSingleQuotes() { var expected = new string[] { "--port", "8080", "--endpoint", "127.0.0.1:8020", "--diag", "\'abc txt\'" }; var argument = "--port 8080 --endpoint 127.0.0.1:8020 --diag \'abc txt\'"; string[] argsArr = UnitTestClient.SplitArguments(argument); Assert.AreEqual(argsArr.Length, 6); CollectionAssert.AreEqual(argsArr, expected); }