Esempio n. 1
0
        public void TestGetGetter()
        {
            SupportBean nestedSupportBean = new SupportBean();

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

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

            Object[]  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));

            try
            {
                eventBean = SupportEventBeanFactory.CreateObject(new Object());
                _eventType.GetGetter("myInt").Get(eventBean);
                Assert.IsTrue(false);
            }
            catch (InvalidCastException ex)
            {
            }
        }
        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 };

            _eventType = new ObjectArrayEventType(null, "", 1, SupportEventAdapterService.Service, typeRep, null, null, null);
            _eventBean = new ObjectArrayEventBean(_testValues, _eventType);
        }
Esempio n. 3
0
        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 = EventTypeMetadata.CreateNonPonoApplicationType(ApplicationType.OBJECTARR, "testtype", true, true, true, false, false);

            _eventType = new ObjectArrayEventType(metadata, "", 1, SupportEventAdapterService.Service, typeRep, null, null, null);
            _eventBean = new ObjectArrayEventBean(_testValues, _eventType);
        }