Beispiel #1
0
        private ExprFilterSpecLookupable MakeLookupable(
            string fieldName,
            EventType eventType)
        {
            SupportExprEventEvaluator eval = new SupportExprEventEvaluator(eventType.GetGetter(fieldName));

            return(new ExprFilterSpecLookupable(fieldName, eval, null, eventType.GetPropertyType(fieldName), false, null));
        }
Beispiel #2
0
        public void TestNodeGetSet()
        {
            FilterHandle exprOne = new SupportFilterHandle();

            // Check pre-conditions
            Assert.IsTrue(testNode.NodeRWLock != null);
            Assert.IsFalse(testNode.Contains(exprOne));
            Assert.AreEqual(0, testNode.FilterCallbackCount);
            Assert.AreEqual(0, testNode.Indizes.Count);
            Assert.IsTrue(testNode.IsEmpty());

            testNode.Add(exprOne);

            // Check after add
            Assert.IsTrue(testNode.Contains(exprOne));
            Assert.AreEqual(1, testNode.FilterCallbackCount);
            Assert.IsFalse(testNode.IsEmpty());

            // Add an indexOne
            EventType eventType = SupportEventTypeFactory
                                  .GetInstance(container)
                                  .CreateBeanType(typeof(SupportBean));
            SupportExprEventEvaluator eval       = new SupportExprEventEvaluator(eventType.GetGetter("IntPrimitive"));
            ExprFilterSpecLookupable  lookupable = new ExprFilterSpecLookupable(
                "IntPrimitive",
                eval,
                null,
                eventType.GetPropertyType("IntPrimitive"),
                false,
                null);
            FilterParamIndexBase indexOne = new SupportFilterParamIndex(lookupable);

            testNode.Add(indexOne);

            // Check after add
            Assert.AreEqual(1, testNode.Indizes.Count);
            Assert.AreEqual(indexOne, testNode.Indizes[0]);

            // Check removes
            Assert.IsTrue(testNode.Remove(exprOne));
            Assert.IsFalse(testNode.IsEmpty());
            Assert.IsFalse(testNode.Remove(exprOne));
            Assert.IsTrue(testNode.Remove(indexOne));
            Assert.IsFalse(testNode.Remove(indexOne));
            Assert.IsTrue(testNode.IsEmpty());
        }