Пример #1
0
        public void TestNodeMatching()
        {
            SupportBeanSimple eventObject = new SupportBeanSimple("DepositEvent_1", 1);
            EventBean         eventBean   = SupportEventBeanFactory.CreateObject(eventObject);

            FilterHandle expr = new SupportFilterHandle();

            _testNode.Add(expr);

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

            _testNode.MatchEvent(eventBean, matches);
            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), ReaderWriterLockManager.CreateDefaultLock());

            _testNode.Add(index);
            index["DepositEvent_1"] = _testEvaluator;

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

            Assert.IsTrue(_testEvaluator.GetAndResetCountInvoked() == 1);
            Assert.IsTrue(_testEvaluator.GetLastEvent() == eventBean);
            Assert.AreEqual(1, matches.Count);
            Assert.AreEqual(expr, matches[0]);
        }
Пример #2
0
 private void Verify(FilterParamIndexBase index, long?testValue, int numExpected)
 {
     _testBean.LongBoxed = testValue;
     index.MatchEvent(_testEventBean, _matchesList);
     Assert.AreEqual(numExpected, _testEvaluator.GetAndResetCountInvoked());
 }
Пример #3
0
 private void VerifyDoublePrimitive(FilterParamIndexBase index, double testValue, int numExpected)
 {
     _testBean.DoublePrimitive = testValue;
     index.MatchEvent(_testEventBean, _matchesList);
     Assert.AreEqual(numExpected, _testEvaluator.GetAndResetCountInvoked());
 }