public void SqlNameSafe() { Assert.IsTrue(string.IsNullOrEmpty(StringUtilsSQL.SqlNameSafe(null))); Assert.IsTrue(string.IsNullOrEmpty(StringUtilsSQL.SqlNameSafe(string.Empty))); Assert.AreEqual("[Raphael.Noeldner]", StringUtilsSQL.SqlNameSafe("Raphael.Noeldner")); Assert.AreEqual("[Table]", StringUtilsSQL.SqlNameSafe("Table")); }
public void SQLNameOK() { Assert.AreEqual("A", StringUtilsSQL.SqlName("A")); var ret = StringUtilsSQL.SqlName("TryInjection]"); Assert.IsTrue(ret == "TryInjection\\]" || ret == "TryInjection]]"); }
public void SqlNameNeedsQuotingTest() { Assert.IsFalse(StringUtilsSQL.SqlNameNeedsQuoting(null)); Assert.IsFalse(StringUtilsSQL.SqlNameNeedsQuoting("")); Assert.IsTrue(StringUtilsSQL.SqlNameNeedsQuoting("Test Value")); Assert.IsTrue(StringUtilsSQL.SqlNameNeedsQuoting("Test.Value")); Assert.IsTrue(StringUtilsSQL.SqlNameNeedsQuoting("1Test")); }
public void SqlIsKeyword() { Assert.AreEqual(false, StringUtilsSQL.SqlIsKeyword(null)); Assert.AreEqual(false, StringUtilsSQL.SqlIsKeyword(string.Empty)); Assert.AreEqual(false, StringUtilsSQL.SqlIsKeyword("Raphael")); Assert.AreEqual(true, StringUtilsSQL.SqlIsKeyword("TABLE")); Assert.AreEqual(true, StringUtilsSQL.SqlIsKeyword("Table")); }
public void SqlNameNeedsQuoting() { Assert.AreEqual(false, StringUtilsSQL.SqlNameNeedsQuoting(null)); Assert.AreEqual(false, StringUtilsSQL.SqlNameNeedsQuoting(string.Empty)); Assert.AreEqual(false, StringUtilsSQL.SqlNameNeedsQuoting("Raphael")); Assert.AreEqual(true, StringUtilsSQL.SqlNameNeedsQuoting("Raphael.Noeldner")); Assert.AreEqual(true, StringUtilsSQL.SqlNameNeedsQuoting("Raphael Nöldner")); Assert.AreEqual(false, StringUtilsSQL.SqlNameNeedsQuoting("RaphaelNoeldner")); Assert.AreEqual(false, StringUtilsSQL.SqlNameNeedsQuoting("RaphaelNöldner")); Assert.AreEqual(true, StringUtilsSQL.SqlNameNeedsQuoting("TABLE")); }
public void SQLQuoteOK() { Assert.AreEqual("A", StringUtilsSQL.SqlQuote("A")); Assert.AreEqual("TryInjection]", StringUtilsSQL.SqlQuote("TryInjection]")); Assert.AreEqual("Try''Injection", StringUtilsSQL.SqlQuote("Try'Injection")); }
public void SQLQuoteNull() { Assert.AreEqual(string.Empty, StringUtilsSQL.SqlQuote(null)); Assert.AreEqual(string.Empty, StringUtilsSQL.SqlQuote(string.Empty)); }