public void BuildQuery_ReturnsNull_IfPathHasUnsupportedSegmen(string path) { var model = ODataPathQueryModel.GetModel(); var pathHandler = new DefaultODataPathHandler(); var odataPath = pathHandler.Parse(model, "http://any/", path); IQueryable source = Array.CreateInstance(typeof(ODataPathQuery_Customer), 0).AsQueryable(); var queryBuilder = new ODataPathQueryBuilder(source, odataPath); ODataPathQueryResult result = queryBuilder.BuildQuery(); Assert.Null(result); }
public void BuildQuery_SetValueFlagToTrue_IfPathHasValueSegment(string path, string expectedQuery) { var model = ODataPathQueryModel.GetModel(); var pathHandler = new DefaultODataPathHandler(); var odataPath = pathHandler.Parse(model, "http://any/", path); IQueryable source = Array.CreateInstance(typeof(ODataPathQuery_Customer), 0).AsQueryable(); var queryBuilder = new ODataPathQueryBuilder(source, odataPath); ODataPathQueryResult result = queryBuilder.BuildQuery(); string queryExpression = ExpressionStringBuilder.ToString(result.Result.Expression); queryExpression = RemoveNameSpace(queryExpression); Assert.Equal(expectedQuery, queryExpression); Assert.True(result.HasValueSegment); Assert.False(result.HasCountSegment); }