Пример #1
0
        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));
        }
Пример #2
0
        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
            }
        }