public void TestCommandLine() { CLBTester clbt = new CLBTester(); clbt.AppendFileNameIfNotNull("a"); Assert.AreEqual(clbt.ToString(), clbt.CommandLine.ToString(), "A1"); }
private void CheckVerifyThrowNoEmbeddedDoubleQuotes(CLBTester clbt, string switchName, string parameter, bool expectException, Type exceptionType, string id) { try { clbt.VerifyThrowNoEmbeddedDoubleQuotes(switchName, parameter); } catch (Exception e) { if (!expectException) { Assert.Fail("({0}) Unexpected exception : {1}", id, exceptionType.ToString()); } if (e.GetType() != exceptionType) { Assert.Fail("({0}) Expected exception of {1} type but got {2}", id, exceptionType.ToString(), e.ToString()); } return; } if (expectException) { Assert.Fail("({0}) Didn't get expected exception {1}", id, exceptionType.ToString()); } }
public void TestAppendTextUnquoted() { CLBTester clbt = new CLBTester(); clbt.AppendTextUnquoted(null); clbt.AppendTextUnquoted("a b"); Assert.AreEqual("a b", clbt.ToString(), "A1"); }
public void TestVerifyThrowNoEmbeddedDoubleQuotes1() { CLBTester clbt = new CLBTester(); clbt.VerifyThrowNoEmbeddedDoubleQuotes(null, null); clbt.VerifyThrowNoEmbeddedDoubleQuotes("", null); clbt.VerifyThrowNoEmbeddedDoubleQuotes(null, ""); clbt.VerifyThrowNoEmbeddedDoubleQuotes(" ", ""); clbt.VerifyThrowNoEmbeddedDoubleQuotes("", " "); clbt.VerifyThrowNoEmbeddedDoubleQuotes("\"abc\"", ""); clbt.VerifyThrowNoEmbeddedDoubleQuotes("x\"y", ""); clbt.VerifyThrowNoEmbeddedDoubleQuotes("\'\'", "\'\'"); }
public void TestAppendSpaceIfNotEmpty() { CLBTester clbt = new CLBTester(); clbt.AppendSpaceIfNotEmpty(); Assert.AreEqual(String.Empty, clbt.ToString(), "A1"); clbt.AppendFileNameIfNotNull("a"); clbt.AppendFileNameIfNotNull("b"); Assert.AreEqual("a b", clbt.ToString(), "A2"); }
public void TestAppendFileNameWithQuoting1() { CLBTester clbt = new CLBTester(); clbt.AppendFileNameWithQuoting(null); Assert.AreEqual(String.Empty, clbt.ToString(), "A1"); clbt.AppendFileNameWithQuoting("abc abc"); Assert.AreEqual("\"abc abc\"", clbt.ToString(), "A2"); clbt = new CLBTester(); clbt.AppendFileNameWithQuoting("abc"); Assert.AreEqual("abc", clbt.ToString(), "A3"); }
public void TestIsQuotingRequired() { CLBTester clbt = new CLBTester(); Assert.AreEqual(false, clbt.IsQuotingRequired(null), "A0"); Assert.AreEqual(false, clbt.IsQuotingRequired(""), "A1"); Assert.AreEqual(true, clbt.IsQuotingRequired(" "), "A2"); Assert.AreEqual(false, clbt.IsQuotingRequired("a"), "A3"); Assert.AreEqual(true, clbt.IsQuotingRequired("a a"), "A4"); Assert.AreEqual(true, clbt.IsQuotingRequired("\'\'"), "A5"); Assert.AreEqual(true, clbt.IsQuotingRequired("\' \'"), "A6"); Assert.AreEqual(true, clbt.IsQuotingRequired("\"\""), "A7"); Assert.AreEqual(true, clbt.IsQuotingRequired("\" \""), "A8"); Assert.AreEqual(true, clbt.IsQuotingRequired("\n\n"), "A9"); Assert.AreEqual(true, clbt.IsQuotingRequired("\n \n"), "A10"); Assert.AreEqual(true, clbt.IsQuotingRequired("\t\t"), "A11"); Assert.AreEqual(true, clbt.IsQuotingRequired("\t \t"), "A12"); Assert.AreEqual(true, clbt.IsQuotingRequired("a;b"), "A13"); Assert.AreEqual(true, clbt.IsQuotingRequired("a\u000bc"), "A14"); Assert.AreEqual(true, clbt.IsQuotingRequired("a\u000cx"), "A15"); Assert.AreEqual(true, clbt.IsQuotingRequired("\""), "A16"); Assert.AreEqual(true, clbt.IsQuotingRequired(" abc"), "A17"); }
private void CheckVerifyThrowNoEmbeddedDoubleQuotes(CLBTester clbt, string switchName, string parameter, bool expectException, Type exceptionType, string id) { try { clbt.VerifyThrowNoEmbeddedDoubleQuotes(switchName, parameter); } catch (Exception e) { if (!expectException) Assert.Fail("({0}) Unexpected exception : {1}", id, exceptionType.ToString()); if (e.GetType () != exceptionType) Assert.Fail("({0}) Expected exception of {1} type but got {2}", id, exceptionType.ToString(), e.ToString()); return; } if (expectException) Assert.Fail("({0}) Didn't get expected exception {1}", id, exceptionType.ToString()); }
public void TestVerifyThrowNoEmbeddedDoubleQuotes1 () { CLBTester clbt = new CLBTester (); clbt.VerifyThrowNoEmbeddedDoubleQuotes (null, null); clbt.VerifyThrowNoEmbeddedDoubleQuotes ("", null); clbt.VerifyThrowNoEmbeddedDoubleQuotes (null, ""); clbt.VerifyThrowNoEmbeddedDoubleQuotes (" ", ""); clbt.VerifyThrowNoEmbeddedDoubleQuotes ("", " "); clbt.VerifyThrowNoEmbeddedDoubleQuotes ("\"abc\"", ""); clbt.VerifyThrowNoEmbeddedDoubleQuotes ("x\"y", ""); clbt.VerifyThrowNoEmbeddedDoubleQuotes ("\'\'", "\'\'"); }
public void TestIsQuotingRequired () { CLBTester clbt = new CLBTester (); Assert.AreEqual (false, clbt.IsQuotingRequired (null), "A0"); Assert.AreEqual (false, clbt.IsQuotingRequired (""), "A1"); Assert.AreEqual (true, clbt.IsQuotingRequired (" "), "A2"); Assert.AreEqual (false, clbt.IsQuotingRequired ("a"), "A3"); Assert.AreEqual (true, clbt.IsQuotingRequired ("a a"), "A4"); Assert.AreEqual (true, clbt.IsQuotingRequired ("\'\'"), "A5"); Assert.AreEqual (true, clbt.IsQuotingRequired ("\' \'"), "A6"); Assert.AreEqual (true, clbt.IsQuotingRequired ("\"\""), "A7"); Assert.AreEqual (true, clbt.IsQuotingRequired ("\" \""), "A8"); Assert.AreEqual (true, clbt.IsQuotingRequired ("\n\n"), "A9"); Assert.AreEqual (true, clbt.IsQuotingRequired ("\n \n"), "A10"); Assert.AreEqual (true, clbt.IsQuotingRequired ("\t\t"), "A11"); Assert.AreEqual (true, clbt.IsQuotingRequired ("\t \t"), "A12"); Assert.AreEqual (true, clbt.IsQuotingRequired("a;b"), "A13"); Assert.AreEqual (true, clbt.IsQuotingRequired("a\u000bc"), "A14"); Assert.AreEqual (true, clbt.IsQuotingRequired("a\u000cx"), "A15"); Assert.AreEqual (true, clbt.IsQuotingRequired("\""), "A16"); Assert.AreEqual (true, clbt.IsQuotingRequired(" abc"), "A17"); }
public void TestCommandLine () { CLBTester clbt = new CLBTester (); clbt.AppendFileNameIfNotNull ("a"); Assert.AreEqual (clbt.ToString (), clbt.CommandLine.ToString (), "A1"); }
public void TestAppendTextWithQuoting () { CLBTester clbt = new CLBTester (); clbt.AppendTextWithQuoting (null); clbt.AppendTextUnquoted ("a b"); Assert.AreEqual ("a b", clbt.ToString (), "A1"); clbt = new CLBTester (); clbt.AppendTextWithQuoting ("a"); Assert.AreEqual ("a", clbt.ToString (), "A2"); }
public void TestAppendSpaceIfNotEmpty () { CLBTester clbt = new CLBTester (); clbt.AppendSpaceIfNotEmpty (); Assert.AreEqual (String.Empty, clbt.ToString (), "A1"); clbt.AppendFileNameIfNotNull ("a"); clbt.AppendFileNameIfNotNull ("b"); Assert.AreEqual ("a b", clbt.ToString (), "A2"); }
public void TestAppendFileNameWithQuoting1 () { CLBTester clbt = new CLBTester (); clbt.AppendFileNameWithQuoting (null); Assert.AreEqual (String.Empty, clbt.ToString (), "A1"); clbt.AppendFileNameWithQuoting ("abc abc"); Assert.AreEqual ("\"abc abc\"", clbt.ToString (), "A2"); clbt = new CLBTester (); clbt.AppendFileNameWithQuoting ("abc"); Assert.AreEqual ("abc", clbt.ToString (), "A3"); }