public void SetUp()
        {
            testProps = new string[] { "aString", "anInt", "MyComplexBean" };
            testTypes = new object[] { typeof(string), typeof(int?), typeof(SupportBeanComplexProps) };
            IDictionary <string, object> typeRep = new LinkedHashMap <string, object>();

            for (int i = 0; i < testProps.Length; i++)
            {
                typeRep.Put(testProps[i], testTypes[i]);
            }

            testValues = new object[] { "test", 10, supportBean };

            EventTypeMetadata metadata = new EventTypeMetadata("MyType", null, EventTypeTypeClass.STREAM, EventTypeApplicationType.OBJECTARR, NameAccessModifier.INTERNAL, EventTypeBusModifier.NONBUS, false, EventTypeIdPair.Unassigned());

            eventType = new ObjectArrayEventType(metadata, typeRep, null, null, null, null,
                                                 SupportEventTypeFactory.GetInstance(container).BEAN_EVENT_TYPE_FACTORY);
            eventBean = new ObjectArrayEventBean(testValues, eventType);
        }
Exemple #2
0
        public void TestGetGetter()
        {
            var nestedSupportBean = new SupportBean();

            nestedSupportBean.IntPrimitive = 100;
            var complexPropBean = SupportBeanComplexProps.MakeDefaultBean();

            Assert.AreEqual(null, eventType.GetGetter("dummy"));

            var       values    = new object[] { 20, 20, "a", nestedSupportBean, complexPropBean, null };
            EventBean eventBean = new ObjectArrayEventBean(values, eventType);

            Assert.AreEqual(20, eventType.GetGetter("MyInt").Get(eventBean));
            Assert.AreEqual(20, eventType.GetGetter("MyIntBoxed").Get(eventBean));
            Assert.AreEqual("a", eventType.GetGetter("MyString").Get(eventBean));
            Assert.AreEqual(nestedSupportBean, eventType.GetGetter("MySupportBean").Get(eventBean));
            Assert.AreEqual(100, eventType.GetGetter("MySupportBean.IntPrimitive").Get(eventBean));
            Assert.AreEqual("NestedValue", eventType.GetGetter("MyComplexBean.Nested.NestedValue").Get(eventBean));
        }