예제 #1
0
        public void TryGetCommonBaseType_WhenTypesDoNotShareCommonTypeNullIsReturned()
        {
            Type commonType;
            bool hasCommonType = ReflectionHelper.TryGetCommonBaseType(out commonType, typeof(Event__), typeof(Event3));

            Assert.IsNull(commonType);
            Assert.IsFalse(hasCommonType);
        }
예제 #2
0
        public void TryGetCommonBaseType_WhenTypesShareCommonTypeItIsReturned()
        {
            Type commonType;
            bool hasCommonType = ReflectionHelper.TryGetCommonBaseType(out commonType, typeof(Event1), typeof(EventA));

            Assert.AreEqual(typeof(Event), commonType);
            Assert.IsTrue(hasCommonType);

            hasCommonType = ReflectionHelper.TryGetCommonBaseType(out commonType, typeof(Event1), typeof(EventA), typeof(Event3));
            Assert.AreEqual(typeof(Event), commonType);
            Assert.IsTrue(hasCommonType);
        }