Пример #1
0
        public void SetUp()
        {
            _mapped    = new MappedProperty[2];
            _mapped[0] = new MappedProperty("Mapped", "keyOne");
            _mapped[1] = new MappedProperty("Mapped", "keyTwo");

            _theEvent  = SupportEventBeanFactory.CreateObject(SupportBeanComplexProps.MakeDefaultBean());
            _eventType = (BeanEventType)_theEvent.EventType;
        }
Пример #2
0
        public void TestGetGetter()
        {
            Object[] expected = new String[] { "valueOne", "valueTwo" };
            for (int i = 0; i < _mapped.Length; i++)
            {
                EventPropertyGetter getter = _mapped[i].GetGetter(_eventType, _container.Resolve <EventAdapterService>());
                Assert.AreEqual(expected[i], getter.Get(_theEvent));
            }

            // try invalid case
            MappedProperty mpd = new MappedProperty("Dummy", "dummy");

            Assert.IsNull(mpd.GetGetter(_eventType, _container.Resolve <EventAdapterService>()));
        }
Пример #3
0
        public void TestGetPropertyType()
        {
            var expected = new Type[] { typeof(string), typeof(string) };

            for (int i = 0; i < _mapped.Length; i++)
            {
                Assert.AreEqual(expected[i], _mapped[i].GetPropertyType(_eventType, _container.Resolve <EventAdapterService>()));
            }

            // try invalid case
            var mpd = new MappedProperty("Dummy", "dummy");

            Assert.IsNull(mpd.GetPropertyType(_eventType, _container.Resolve <EventAdapterService>()));
            mpd = new MappedProperty("MapProperty", "dummy");
            Assert.AreEqual(typeof(string), mpd.GetPropertyType(_eventType, _container.Resolve <EventAdapterService>()));
        }