public Criteria(string path, IQueryCollection query) { Path = path; Paginate = PaginateExpression.Extract(query); Slice = SliceExpression.Extract(query); FullTextSearch = FullTextSearchExpression <TIn> .Extract(query); Sort = OrderByExpression <TIn> .Extract(query); Filters = FilterCollectionExpression <TIn> .Extract(query); Operators = OperatorCollectionExpression <TIn> .Extract(query); Embeds = EmbedCollectionExpression <TIn> .Extract(query); }
public void OperatorCollectionExpression_With_like() { //Arrange var values = new Dictionary <string, StringValues> { { "name_like", new StringValues("Ale") } }; var query = new QueryCollection(values); //Act var operatorCollection = OperatorCollectionExpression <UserMetaDataCriteria> .Extract(query); var text = operatorCollection.ToString(); //Assert text.Should().Be("name_like=Ale"); operatorCollection.Operators.Should().HaveCount(1); }
public void OperatorCollectionExpression_With_gte_lte() { //Arrange var values = new Dictionary <string, StringValues> { { "age_gte", new StringValues("25") }, { "age_lte", new StringValues("20") } }; var query = new QueryCollection(values); //Act var operatorCollection = OperatorCollectionExpression <UserMetaDataCriteria> .Extract(query); var text = operatorCollection.ToString(); //Assert text.Should().Be("age_gte=25&age_lte=20"); operatorCollection.Operators.Should().HaveCount(2); }