Ejemplo n.º 1
0
        public void ClassicAggregate()
        {
            IList args = new ArrayList();

            ClassicAggregateFunction caf = new ClassicAggregateFunction("max", false);

            args.Add("va1");
            Assert.AreEqual("max(va1)", caf.Render(args, factoryImpl).ToString());

            args.Clear();
            args.Add("distinct");
            args.Add("va2");
            Assert.AreEqual("max(distinct va2)", caf.Render(args, factoryImpl).ToString());

            args.Clear();
            args.Add("va1");
            args.Add("va2");
            try
            {
                SqlString t = caf.Render(args, factoryImpl);
                Assert.Fail("No exception 2 argument without <setquantifier>:" + t);
            }
            catch (QueryException)
            {
                //correct
            }

            args.Clear();
            args.Add("*");
            try
            {
                SqlString t = caf.Render(args, factoryImpl);
                Assert.Fail("No exception '*' :" + t);
            }
            catch (QueryException)
            {
                //correct
            }
        }
Ejemplo n.º 2
0
        public void ClassicAggregate()
        {
            IList args = new ArrayList();

            ClassicAggregateFunction caf = new ClassicAggregateFunction("max", false);

            args.Add("va1");
            Assert.AreEqual("max(va1)", caf.Render(args, factoryImpl).ToString());

            args.Clear();
            args.Add("distinct");
            args.Add("va2");
            Assert.AreEqual("max(distinct va2)", caf.Render(args, factoryImpl).ToString());

            args.Clear();
            args.Add("va1");
            args.Add("va2");
            Assert.Throws <QueryException>(() => caf.Render(args, factoryImpl), "No exception 2 argument without <setquantifier>");

            args.Clear();
            args.Add("*");
            Assert.Throws <QueryException>(() => caf.Render(args, factoryImpl));
        }