Ejemplo n.º 1
0
        public EnumEntityFilter_()
        {
            var entity = new Entity(typeof(TestEntity));
            _property = entity["Option"];

            _filter = new EnumEntityFilter(_property, "0");
        }
Ejemplo n.º 2
0
        public void selected_value_should_match()
        {
            _filter = new EnumEntityFilter(_property, "0");
            var options = _filter.Options.ToList();
            Assert.True(options[1].Selected);

            _filter = new EnumEntityFilter(_property, "1");
            options = _filter.Options.ToList();
            Assert.True(options[2].Selected);
        }
Ejemplo n.º 3
0
        public IList<IEntityFilter> PrepareFilters(Entity entity)
        {
            var filters = new List<IEntityFilter>();

            foreach (var property in entity.Properties.Where(x => x.TypeInfo.DataType == DataType.Bool))
            {
                var value = Request[property.Name];

                var filter = new BoolEntityFilter();
                filter.Initialize(property, value);
                filters.Add(filter);
            }

            foreach (var property in entity.Properties.Where(x => x.TypeInfo.DataType == DataType.Enum))
            {
                var value = Request[property.Name];

                var filter = new EnumEntityFilter();
                filter.Initialize(property, value);
                filters.Add(filter);
            }

            foreach (var property in entity.Properties.Where(x => x.TypeInfo.DataType == DataType.DateTime))
            {
                var value = Request[property.Name];

                var filter = new DateTimeEntityFilter();
                filter.Initialize(property, value);
                filters.Add(filter);
            }

            return filters;
        }