示例#1
0
        public void GetReleasesByNameTest()
        {
            Release release1 = CreateRelease();
            Release release2 = CreateRelease();


            LogicalQueryPhrase namePhrase = new LogicalQueryPhrase(Release.NAME_FIELD);

            namePhrase.AddExpression(release1.Name, ComparisonOperator.Equal);
            namePhrase.AddExpression(release2.Name, ComparisonOperator.Equal);

            List <QueryPhrase> queryPhrases = new List <QueryPhrase>();

            queryPhrases.Add(namePhrase);

            EntityListResult <Release> result = entityService.Get <Release>(workspaceContext, queryPhrases, null);

            Assert.AreEqual <int>(2, result.data.Count);
        }
        private LogicalQueryPhrase BuildCriteria(List <UserItem> userItems, Func <UserItem, BaseEntity> getReferenceEntityFunc)
        {
            var idPhrase = new LogicalQueryPhrase("id");

            foreach (UserItem userItem in userItems)
            {
                BaseEntity referenceEntity = getReferenceEntityFunc(userItem);
                if (referenceEntity != null)
                {
                    idPhrase.AddExpression(referenceEntity.Id, ComparisonOperator.Equal);
                }
            }

            return(idPhrase);
        }