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); }
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); }
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")); } }
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); } }
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")); }
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"]); }
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); }
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); } }