public void CanParseCollectionFilter() { var rootNode = ScimExpressionParser.ParseExpression(CollectionFilter); Assert.NotNull(rootNode); Console.WriteLine(rootNode); }
public IEnumerable <ScimUser> Query(string filter, int skip, int count) { Check.Argument.IsNotNullOrEmpty(filter, "filter"); var filterNode = ScimExpressionParser.ParseExpression(filter); var predicate = this.filterBinder.Bind <UserAccount>(filterNode, null, true, this.mapper); var results = this.userAccountManager.Queryable.Search(predicate, null, null); return(results.Select(this.ToScimUser)); }
public void CanConvertBasicFilter() { var mapperMoq = new Mock <IAttributeNameMapper>(); mapperMoq.Setup(m => m.MapToInternal(It.IsAny <string>())).Returns((string s) => char.ToUpper(s[0]) + s.Substring(1)); var filterNode = ScimExpressionParser.ParseExpression(BasicFilter); var converter = new DefaultFilterBinder(); var predicate = converter.Bind <UserAccount>(filterNode, string.Empty, false, mapperMoq.Object); Assert.NotNull(predicate); Console.WriteLine(predicate); var usersCount = this._testUsers.AsQueryable().Count(predicate); Assert.Equal(2, usersCount); }