Exemple #1
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));
        }
        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);
        }
Exemple #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));
        }
Exemple #4
0
        public void ReturnFalseIfAnyChildFilterFalse()
        {
            var e = new SystemEvent {
                Level = SystemEventLevel.Error, ProcessId = 123, 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.False(Filter.Compile(filter).Invoke(e));
        }
Exemple #5
0
        public void AlwaysCompositeExpression()
        {
            var filter = new AndAlsoFilter(new FakeExtendedProperties(), Enumerable.Empty <ICreateFilterExpressions>());

            Assert.True(filter.CompositeExpression);
        }