private static EventType[] GetBaseTypes(Type clazz, BeanEventTypeFactory beanEventTypeFactory) { var superclasses = new List <Type>(); // add superclass var superClass = clazz.BaseType; if (superClass != null) { superclasses.Add(superClass); } // add interfaces Type[] interfaces = clazz.GetInterfaces(); superclasses.AddAll(interfaces); // Build event types, ignoring language types var superTypes = new List <EventType>(); foreach (var superclass in superclasses) { if (!superclass.Name.StartsWith("System")) { EventType superType = beanEventTypeFactory.CreateBeanType(superclass.FullName, superclass, false, false, false); superTypes.Add(superType); } } return(superTypes.ToArray()); }
public void TestCreateBeanType() { BeanEventType eventType = _beanEventTypeFactory.CreateBeanType("a", typeof(SupportBeanSimple), true, true, true); Assert.AreEqual(typeof(SupportBeanSimple), eventType.UnderlyingType); Assert.AreEqual(2, eventType.PropertyNames.Length); // Second call to create the event type, should be the same instance as the first EventType eventTypeTwo = _beanEventTypeFactory.CreateBeanType("b", typeof(SupportBeanSimple), true, true, true); Assert.IsTrue(eventTypeTwo == eventType); // Third call to create the event type, getting a given event type id EventType eventTypeThree = _beanEventTypeFactory.CreateBeanType("c", typeof(SupportBeanSimple), true, true, true); Assert.IsTrue(eventTypeThree == eventType); }