static WithStaticFilterDefinition()
        {
            var systemEvent = Expression.Parameter(typeof(SystemEvent), "e");
            var filterParameters = new FilterParameters { systemEvent };
            var expression = new AndAlsoFilter(new FakeExtendedProperties(), Enumerable.Empty<ICreateFilterExpressions>()).CreateExpression(filterParameters);

            StaticFilter = new StaticFilterExpression(systemEvent, expression);
        }
Esempio n. 2
0
        public void ReturnTrueIfNoChildFilters()
        {
            var e = new SystemEvent();
            var extendedProperties = new FakeExtendedProperties { { "property", "Level" }, { "value", "Warning" } };
            var filter = new AndAlsoFilter(extendedProperties, Enumerable.Empty<ICreateFilterExpressions>());

            Assert.True(Filter.Compile(filter).Invoke(e));
        }
Esempio n. 3
0
        public void ReturnFalseIfSingleChildFilterFalse()
        {
            var e = new SystemEvent { Level = SystemEventLevel.Error };
            var extendedProperties = new FakeExtendedProperties { { "property", "Level" }, { "value", "Warning" } };
            var filter = new AndAlsoFilter(new FakeExtendedProperties(), new[] { new EqualFilter(extendedProperties, Enumerable.Empty<ICreateFilterExpressions>()) });

            Assert.False(Filter.Compile(filter).Invoke(e));
        }
Esempio n. 4
0
        public void ReturnTrueIfAllChildFiltersTrue()
        {
            var e = new SystemEvent { Level = SystemEventLevel.Error, ProcessId = 1234, Thread = "Unknown" };
            var filter = new AndAlsoFilter(
                             new FakeExtendedProperties(),
                             new[]
                                 {
                                     new EqualFilter(new FakeExtendedProperties { { "property", "ProcessId" }, { "value", "1234" } }, Enumerable.Empty<ICreateFilterExpressions>()),
                                     new EqualFilter(new FakeExtendedProperties { { "property", "Thread" }, { "value", "Unknown" } }, Enumerable.Empty<ICreateFilterExpressions>()),
                                     new EqualFilter(new FakeExtendedProperties { { "property", "Level" }, { "value", "Error" } }, Enumerable.Empty<ICreateFilterExpressions>())
                                 });

            Assert.True(Filter.Compile(filter).Invoke(e));
        }
Esempio n. 5
0
        public void AlwaysCompositeExpression()
        {
            var filter = new AndAlsoFilter(new FakeExtendedProperties(), Enumerable.Empty<ICreateFilterExpressions>());

            Assert.True(filter.CompositeExpression);
        }