예제 #1
0
        public void TestWhereClauseZero()
        {
            DataQueryBuilder qb = DataQueryBuilder.Create();

            qb.AddAllProperties();
            qb.SetWhereClause("name='Joe'");
            IList <Dictionary <String, Object> > res = Backendless.Data.Of("Orders").Find(qb);

            Assert.IsTrue(res.Count == 0);
        }
예제 #2
0
        public void TestRelationsWithClass()
        {
            DataQueryBuilder qb = DataQueryBuilder.Create();

            qb.AddAllProperties();
            qb.SetRelated(new List <String> {
                "Related"
            });
            IList <Orders> res = Backendless.Data.Of <Orders>().Find(qb);

            Assert.IsTrue(res[0].Related.Count == 1);
        }
예제 #3
0
        public void TestGroupBy()
        {
            DataQueryBuilder qb = DataQueryBuilder.Create();

            qb.AddAllProperties();
            qb.AddGroupBy("Percentage");
            IList <Dictionary <String, Object> > res = Backendless.Data.Of("CountryLanguage").Find(qb);

            foreach (Dictionary <String, Object> entry in res)
            {
                Assert.IsTrue(entry.ContainsKey("Percentage"));
            }
        }
예제 #4
0
        public void TestWhereClauseNotZero()
        {
            DataQueryBuilder qb = DataQueryBuilder.Create();

            qb.AddAllProperties();
            qb.SetWhereClause("Percentage > 30");
            IList <Dictionary <String, Object> > res = Backendless.Data.Of("CountryLanguage").Find(qb);

            foreach (Dictionary <String, Object> entry in res)
            {
                Assert.IsTrue((Double)entry["Percentage"] > 30.0);
            }
        }
예제 #5
0
        public void TestRelations()
        {
            DataQueryBuilder qb = DataQueryBuilder.Create();

            qb.AddAllProperties();
            qb.SetRelated(new List <String>()
            {
                "Related"
            });
            IList <Dictionary <String, Object> > res = Backendless.Data.Of("Orders").Find(qb);

            Assert.IsTrue(res[0].ContainsKey("Related"));
            Assert.IsTrue(res[1].ContainsKey("Related"));
        }
예제 #6
0
        public void TestSort()
        {
            DataQueryBuilder qb = DataQueryBuilder.Create();

            qb.AddAllProperties();
            qb.SetRelated(new List <String> {
                "Related"
            });
            qb.SetSortBy(new List <String> {
                "age"
            });
            IList <Dictionary <String, Object> > res = Backendless.Data.Of("Orders").Find(qb);

            Assert.IsTrue((Double)res[0]["age"] < (Double)res[1]["age"]);
        }
예제 #7
0
        public void TestRelationPageSizeZero()
        {
            DataQueryBuilder qb = DataQueryBuilder.Create();

            qb.AddAllProperties();
            qb.SetRelationsPageSize(0);
            qb.SetRelated(new List <String> {
                "Related"
            });
            IList <Dictionary <String, Object> > res = Backendless.Data.Of("Orders").Find(qb);

            Object[] rel = (Object[])res[0]["Related"];

            Assert.IsTrue(rel.Length == 0);
        }
예제 #8
0
        public void TestRelationsDepth()
        {
            DataQueryBuilder qb = DataQueryBuilder.Create();

            qb.AddAllProperties();
            qb.SetRelationsDepth(1);
            qb.SetRelated(new List <String> {
                "Country"
            });
            IList <Dictionary <String, Object> > res = Backendless.Data.Of("CountryLanguage").Find(qb);

            if (res[0].ContainsKey("Country"))
            {
                Object entry = res[0]["Country"];
                Assert.IsFalse(((Dictionary <Object, Object>)entry).ContainsKey("Capital"));
            }
            else
            {
                Assert.IsFalse(true);
            }
        }