Exemplo n.º 1
0
        public void TestViewUpdate()
        {
            var eventData = new Dictionary <String, Object>();

            // Generate some events
            eventData["STDDEV"] = 100;
            EventBean eventBeanOne = SupportEventBeanFactory.CreateMapFromValues(
                new Dictionary <String, Object>(eventData), _parentEventType);

            eventData["STDDEV"] = 0;
            EventBean eventBeanTwo = SupportEventBeanFactory.CreateMapFromValues(
                new Dictionary <String, Object>(eventData), _parentEventType);

            eventData["STDDEV"] = 99999;
            EventBean eventBeanThree = SupportEventBeanFactory.CreateMapFromValues(
                new Dictionary <String, Object>(eventData), _parentEventType);

            // Send events
            _parentView.Update(new EventBean[] { eventBeanOne, eventBeanTwo }, new EventBean[] { eventBeanThree });

            // Checks
            EventBean[] newData = _childView.LastNewData;
            Assert.AreEqual(2, newData.Length);
            Assert.AreEqual("IBM", newData[0].Get("Symbol"));
            Assert.AreEqual(100, newData[0].Get("STDDEV"));
            Assert.AreEqual("IBM", newData[1].Get("Symbol"));
            Assert.AreEqual(0, newData[1].Get("STDDEV"));

            EventBean[] oldData = _childView.LastOldData;
            Assert.AreEqual(1, oldData.Length);
            Assert.AreEqual("IBM", oldData[0].Get("Symbol"));
            Assert.AreEqual(99999, oldData[0].Get("STDDEV"));
        }
Exemplo n.º 2
0
        public void TestAddProperty()
        {
            IDictionary <String, Object> eventData = new Dictionary <String, Object>();

            eventData["STDDEV"] = 100;
            EventBean eventBean = SupportEventBeanFactory.CreateMapFromValues(eventData, _parentEventType);

            IDictionary <String, Object> addProps = new Dictionary <String, Object>();

            addProps["test"] = typeof(int);
            EventType newEventType = SupportEventAdapterService.Service.CreateAnonymousWrapperType("test", _parentEventType, addProps);
            EventBean newBean      = AddPropertyValueOptionalView.AddProperty(
                eventBean,
                new String[] { "test" },
                new MultiKeyUntyped(new Object[] { 2 }),
                newEventType,
                SupportEventAdapterService.Service);

            Assert.AreEqual(2, newBean.Get("test"));
            Assert.AreEqual(100, newBean.Get("STDDEV"));
        }