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