public void TestSingleFilter() { QueryBase query = CrmQuery .Select() .From("mydynamic") .Where("mydynamic", "prop1", ConditionOperator.Equal, new object[] { "foo" }).Query; EntityCollection bec = m_service.RetrieveMultiple(query); Fest.AssertTrue(bec.Entities.Count > 0, "found more than zero entities"); }
public void TestLinks() { QueryBase query = CrmQuery .Select() .From("subject") .Join("subject", "subjectid", "subject", "parentsubject") .Where("subject", "title", ConditionOperator.Equal, new object[] { "child" }).Query; EntityCollection bec = m_service.RetrieveMultiple(query); Fest.AssertTrue(bec.Entities.Count > 0, "found more than zero entities"); }
public void TestMultipleFilters() { QueryBase query = CrmQuery .Select() .From("contact") .Where("contact", "address1_name", ConditionOperator.Equal, new object[] { "Dan" }) .Where("contact", "address1_city", ConditionOperator.Equal, new object[] { "Bethesda" }).Query; EntityCollection bec = m_service.RetrieveMultiple(query); Fest.AssertTrue(bec.Entities.Count > 0, "found more than zero entities"); }
public void TestFilters() { ConditionExpression cond = new ConditionExpression("address1_name", ConditionOperator.Equal, new string[] { "Dan" }); ConditionExpression cond2 = new ConditionExpression("address1_city", ConditionOperator.Equal, new string[] { "Bethesda" }); FilterExpression fe = new FilterExpression(); fe.FilterOperator = LogicalOperator.And; fe.Conditions.Add(cond); fe.Conditions.Add(cond2); QueryExpression qe = new QueryExpression("contact"); qe.Criteria = fe; BusinessEntityCollection bec = m_service.RetrieveMultiple(qe); Console.WriteLine("TestFilters() found: " + bec.BusinessEntities.Count + " entity. "); Fest.AssertTrue(bec.BusinessEntities.Count > 0, "found more than zero entities"); }
public void TestLinks() { ConditionExpression cond = new ConditionExpression("title", ConditionOperator.Equal, new string[] { "child" }); FilterExpression fe = new FilterExpression(); fe.FilterOperator = LogicalOperator.And; fe.Conditions.Add(cond); LinkEntity le = new LinkEntity("subject", "subject", "subjectid", "parentsubject", JoinOperator.Inner); le.LinkCriteria = fe; QueryExpression qe = new QueryExpression("subject"); qe.LinkEntities.Add(le); BusinessEntityCollection bec = m_service.RetrieveMultiple(qe); Console.WriteLine("TestLinks() found: " + bec.BusinessEntities.Count + " entity. "); Fest.AssertTrue(bec.BusinessEntities.Count > 0, "found more than zero entities"); }