public void NoArgFunction() { IList args = new ArrayList(); NoArgSQLFunction nf = new NoArgSQLFunction("noArgs", NHibernateUtil.String); Assert.IsTrue(nf.HasParenthesesIfNoArguments); Assert.AreEqual("noArgs()", nf.Render(args, factoryImpl).ToString()); nf = new NoArgSQLFunction("noArgs", NHibernateUtil.String, false); Assert.IsFalse(nf.HasParenthesesIfNoArguments); Assert.AreEqual("noArgs", nf.Render(args, factoryImpl).ToString()); args.Add("aparam"); Assert.Throws <QueryException>(() => nf.Render(args, factoryImpl)); }
public void NoArgFunction() { IList args = new ArrayList(); NoArgSQLFunction nf = new NoArgSQLFunction("noArgs", NHibernateUtil.String); Assert.IsTrue(nf.HasParenthesesIfNoArguments); Assert.AreEqual("noArgs()", nf.Render(args, factoryImpl).ToString()); nf = new NoArgSQLFunction("noArgs", NHibernateUtil.String, false); Assert.IsFalse(nf.HasParenthesesIfNoArguments); Assert.AreEqual("noArgs", nf.Render(args, factoryImpl).ToString()); args.Add("aparam"); try { SqlString t = nf.Render(args, factoryImpl); Assert.Fail("No exception if has argument"); } catch (QueryException) { //correct } }