示例#1
0
 private void VerifyDoublePrimitive(
     FilterParamIndexBase index,
     double testValue,
     int numExpected)
 {
     testBean.DoublePrimitive = testValue;
     index.MatchEvent(testEventBean, matchesList, null);
     Assert.AreEqual(numExpected, testEvaluator.GetAndResetCountInvoked());
 }
示例#2
0
 private void VerifyShortBoxed(
     FilterParamIndexBase index,
     short?testValue,
     int numExpected)
 {
     testBean.ShortBoxed = testValue;
     index.MatchEvent(testEventBean, matchesList, null);
     Assert.AreEqual(numExpected, testEvaluator.GetAndResetCountInvoked());
 }
示例#3
0
        public void TestNodeMatching()
        {
            var eventObject = new SupportBeanSimple("DepositEvent_1", 1);
            var eventBean   = SupportEventBeanFactory
                              .GetInstance(container)
                              .CreateObject(eventObject);

            FilterHandle expr = new SupportFilterHandle();

            testNode.Add(expr);

            // Check matching without an index node
            IList <FilterHandle> matches = new List <FilterHandle>();

            testNode.MatchEvent(eventBean, matches, null);
            Assert.AreEqual(1, matches.Count);
            Assert.AreEqual(expr, matches[0]);
            matches.Clear();

            // Create, add and populate an index node
            FilterParamIndexBase index = new FilterParamIndexEquals(
                MakeLookupable("MyString", eventBean.EventType),
                new SlimReaderWriterLock());

            testNode.Add(index);
            index.Put("DepositEvent_1", testEvaluator);

            // Verify matcher instance stored in index is called
            testNode.MatchEvent(eventBean, matches, null);

            Assert.IsTrue(testEvaluator.GetAndResetCountInvoked() == 1);
            Assert.IsTrue(testEvaluator.LastEvent == eventBean);
            Assert.AreEqual(1, matches.Count);
            Assert.AreEqual(expr, matches[0]);
        }