public void ConvertsExpressionToString2() { var converter = new ODataExpressionConverter(); Expression <Func <ChildDto, bool> > expression = x => x.Name.Length + (1 + 1) == 7; var serialized = converter.Convert(expression); Assert.AreEqual("length(Name) add 2 eq 7", serialized); }
public void ConvertsExpressionToString() { var converter = new ODataExpressionConverter(); Expression <Func <ChildDto, bool> > expression = x => x.Name == "blah"; var serialized = converter.Convert(expression); Assert.AreEqual("Name eq 'blah'", serialized); }
public void CanSerializeEmptyGuid() { var converter = new ODataExpressionConverter(); Expression <Func <ChildDto, bool> > expression = x => x.GlobalID != Guid.Empty; var serialized = converter.Convert(expression); Assert.AreEqual("GlobalID ne guid'00000000-0000-0000-0000-000000000000'", serialized); }
public void CanFilterOnSubCollection() { var converter = new ODataExpressionConverter(); Expression <Func <FakeItem, bool> > expression = x => x.Child.Attributes.Any(y => y == "blah"); var serialized = converter.Convert(expression); Assert.AreEqual("Child/Attributes/any(y: y eq 'blah')", serialized); }
public void ConvertsFilterToExpression2() { const string Filter = "(length(Name) add 2) eq 7"; var converter = new ODataExpressionConverter(); Expression <Func <ChildDto, bool> > expression = x => x.Name.Length + (1 + 1) == 7; var converted = converter.Convert <ChildDto>(Filter); Assert.AreEqual(expression.ToString(), converted.ToString()); }
public void ConvertsFilterToExpression() { const string Filter = "Name eq 'blah'"; var converter = new ODataExpressionConverter(); Expression <Func <ChildDto, bool> > expression = x => x.Name == "blah"; var converted = converter.Convert <ChildDto>(Filter); Assert.AreEqual(converted.ToString(), expression.ToString()); }
public RestRequestAsyncHandle QueryAsync(Expression <Func <T, bool> > predicate, Action <AzureResponse <List <T> > > callback) { ODataExpressionConverter c = new ODataExpressionConverter(); var query = c.Convert <T>(predicate); var request = new RestRequest(_tableName + "?$filter=" + query, Method.GET); var handle = _client.ExecuteAsync <List <T> >(request, GetAsyncHandler); _ListCallbacks.Add(handle, callback); return(handle); }