Beispiel #1
0
        public void ReturnTrueIfNoChildFilters()
        {
            var e = new SystemEvent();
            var extendedProperties = new FakeExtendedProperties {
                { "property", "Level" }, { "value", "Warning" }
            };
            var filter = new OrElseFilter(extendedProperties, Enumerable.Empty <ICreateFilterExpressions>());

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

            Assert.False(Filter.Compile(filter).Invoke(e));
        }
Beispiel #3
0
        public void ReturnFalseIfAllChildFiltersFalse()
        {
            var e = new SystemEvent {
                Level = SystemEventLevel.Error, ProcessId = 123, Thread = "Unknown"
            };
            var filter = new OrElseFilter(
                new FakeExtendedProperties(),
                new[]
            {
                new EqualFilter(new FakeExtendedProperties {
                    { "property", "ProcessId" }, { "value", "1234" }
                }, Enumerable.Empty <ICreateFilterExpressions>()),
                new EqualFilter(new FakeExtendedProperties {
                    { "property", "Thread" }, { "value", "Main" }
                }, Enumerable.Empty <ICreateFilterExpressions>()),
                new EqualFilter(new FakeExtendedProperties {
                    { "property", "Level" }, { "value", "Warning" }
                }, Enumerable.Empty <ICreateFilterExpressions>())
            });

            Assert.False(Filter.Compile(filter).Invoke(e));
        }
Beispiel #4
0
        public void AlwaysCompositeExpression()
        {
            var filter = new OrElseFilter(new FakeExtendedProperties(), Enumerable.Empty <ICreateFilterExpressions>());

            Assert.True(filter.CompositeExpression);
        }