Exemple #1
0
        public FilterByText(DynamicFilterExpression dynamicFilter, String propertyName)
        {
            Verify.NotNull(dynamicFilter, "dynamicFilter");
            Verify.NotWhitespace(propertyName, "propertyName");
            Verify.True(dynamicFilter.HasProperty(propertyName), "propertyName", String.Format("Unknown '{0}' property specified: {1}", typeof(SystemEvent).Name, propertyName));

            InitializeComponent();

            filter   = dynamicFilter;
            property = propertyName;

            addFilter.Click   += (sender, e) => HandleEvent(AddFilter);
            clearFilter.Click += (sender, e) => HandleEvent(ClearFilter);
            resetButton.Click += (sender, e) => HandleEvent(ResetFilter);
            filters.KeyDown   += (sender, e) => HandleEvent(() => { if (e.KeyCode == Keys.Delete)
                                                                    {
                                                                        RemoveFilter();
                                                                    }
                                                                    e.Handled = true; });
            filterText.KeyDown += (sender, e) => HandleEvent(() => { if (e.KeyCode == Keys.Enter)
                                                                     {
                                                                         addFilter.PerformClick();
                                                                     }
                                                                     e.Handled = true; });
        }
        public void ReturnTrueIfSystemEventProperty()
        {
            var dynamicFilter = new DynamicFilterExpression(StaticFilter);

            foreach (var property in typeof(SystemEvent).GetProperties())
            {
                Assert.True(dynamicFilter.HasProperty(property.Name));
            }
        }
        public void ReturnFalseIfNotSystemEventProperty()
        {
            var dynamicFilter = new DynamicFilterExpression(StaticFilter);

            Assert.False(dynamicFilter.HasProperty("DoesNotExist"));
        }