Ejemplo n.º 1
0
        public void Scalar_Count_Test()
        {
            var parmsList = new List <SDataParameters>();
            var client    = CreateClient(parmsList, CreateCollection <object>(null, 10));
            var executor  = new SDataQueryExecutor(client);
            var builder   = CreateQueryBuilder <Contact>(true);

            builder.AddResultOperator(new CountResultOperator());
            var result = executor.ExecuteScalar <int>(builder.Build());

            Assert.That(parmsList[0].Count, Is.EqualTo(0));
            Assert.That(result, Is.EqualTo(10));
        }
Ejemplo n.º 2
0
        public void Scalar_Any_Take_Zero_Test()
        {
            var parmsList = new List <SDataParameters>();
            var client    = CreateClient <object>(parmsList);
            var executor  = new SDataQueryExecutor(client);
            var builder   = CreateQueryBuilder <Contact>(true);

            builder.AddResultOperator(new TakeResultOperator(Expression.Constant(0)));
            builder.AddResultOperator(new AnyResultOperator());
            var result = executor.ExecuteScalar <bool>(builder.Build());

            Assert.That(parmsList, Is.Empty);
            Assert.That(result, Is.False);
        }
Ejemplo n.º 3
0
        public void Scalar_All_Different_Test()
        {
            var parmsList = new List <SDataParameters>();
            var client    = CreateClient(parmsList, CreateCollection <object>(null, 3), CreateCollection <object>(null, 2));
            var executor  = new SDataQueryExecutor(client);
            var builder   = CreateQueryBuilder <Contact>(true);

            builder.AddResultOperator(new AllResultOperator(Expression.Constant(true)));
            var result = executor.ExecuteScalar <bool>(builder.Build());

            Assert.That(parmsList[0].Count, Is.EqualTo(0));
            Assert.That(parmsList[1].Count, Is.EqualTo(0));
            Assert.That(parmsList[1].Where, Is.EqualTo("true"));
            Assert.That(result, Is.False);
        }
Ejemplo n.º 4
0
        public void Scalar_ExtensionArgs_Test()
        {
            var parmsList = new List <SDataParameters>();
            var client    = CreateClient(parmsList, CreateCollection <object>(null, 10));
            var executor  = new SDataQueryExecutor(client);
            var builder   = CreateQueryBuilder <Contact>(true);

            builder.AddResultOperator(new WithExtensionArgResultOperator("foo", "bar"));
            builder.AddResultOperator(new CountResultOperator());
            executor.ExecuteScalar <int>(builder.Build());

            Assert.That(parmsList[0].ExtensionArgs, Is.EqualTo(new Dictionary <string, string> {
                { "foo", "bar" }
            }));
        }