public void Constructor_WithValues_PropertiesAreSet()
        {
            var filter = new SelectorFilter("test_dimension", "test_value");

            Assert.That(filter.Dimension, Is.EqualTo("test_dimension"));
            Assert.That(filter.Value, Is.EqualTo("test_value"));
        }
Beispiel #2
0
        public static FilterResult <Selector> EnumToResult <TType>(SelectorFilter <Selector> filter)
        {
            var values =
                (from object value in Enum.GetValues(typeof(TType))
                 select new Selector {
                Id = (int)value,
                Text = Enum.GetName(typeof(TType), value)
            })
                .Where(filter.ToExpresion().Compile())
                .OrderBy(e => e.Text)
                .ToList();

            var total =
                values.Count;

            var result =
                values.Skip(filter.Size * (filter.Page - 1))
                .Take(filter.Size)
                .ToList();

            return(new FilterResult <Selector> {
                Items = result,
                Total = total
            });
        }
Beispiel #3
0
        public FilterResult <Selector> Selector(SelectorFilter <TEntity> filter)
        {
            var query =
                Table.AsNoTracking()
                .Where(filter.ToExpressionBefore())
                .Select(filter.ToSelector());

            return(Search(filter, query));
        }
Beispiel #4
0
        public void Constructor_WithName_NameIsSet()
        {
            var filter = new SelectorFilter("test", "value");
            var agg    = new CountAggregator("test");

            var aggregator = new FilteredAggregator(filter, agg);

            Assert.That(aggregator.Filter, Is.EqualTo(filter));
            Assert.That(aggregator.Aggregator, Is.EqualTo(agg));
        }
        public void Constructor_TypeIsCorrect()
        {
            var filter = new SelectorFilter("test_dimension", "test_value");

            Assert.That(filter.Type, Is.EqualTo("selector"));
        }