Example #1
0
        public void Should_return_null_when_filter_of_negation_get_optimized_away()
        {
            var source = ClrFilter.Not(ClrFilter.And());

            var result = Optimizer <ClrValue> .Optimize(source);

            Assert.Null(result);
        }
Example #2
0
        public void Should_return_null_when_logical_filter_has_no_filter()
        {
            var source = ClrFilter.And();

            var result = Optimizer <ClrValue> .Optimize(source);

            Assert.Null(result);
        }
Example #3
0
        public void Should_return_filter_When_logical_filter_has_one_child()
        {
            var source = ClrFilter.And(ClrFilter.Eq("path", 1), ClrFilter.Or());

            var result = Optimizer <ClrValue> .Optimize(source);

            Assert.Equal("path == 1", result.ToString());
        }
Example #4
0
        public void Should_return_null_if_filters_of_logical_filter_get_optimized_away()
        {
            var source = ClrFilter.And(ClrFilter.And());

            var result = Optimizer <ClrValue> .Optimize(source);

            Assert.Null(result);
        }
Example #5
0
        public async Task Should_query_assets_by_tags_and_name(DomainId?parentId)
        {
            var query = new ClrQuery
            {
                Filter = F.And(F.Eq("Tags", _.RandomValue()), F.Contains("FileName", _.RandomValue()))
            };

            var assets = await QueryAsync(parentId, query);

            Assert.NotNull(assets);
        }
Example #6
0
        public void Should_add_fields_from_filters()
        {
            var query = new ClrQuery
            {
                Filter =
                    ClrFilter.And(
                        ClrFilter.Not(
                            ClrFilter.Eq("field1", 1)),
                        ClrFilter.Or(
                            ClrFilter.Eq("field2", 2),
                            ClrFilter.Eq("field2", 4)))
            };

            var fields = query.GetAllFields();

            var expected = new HashSet <string>
            {
                "field1",
                "field2"
            };

            Assert.Equal(expected, fields);
        }