Exemplo n.º 1
0
        public void Type_GetInterface()
        {
            Type typeBar = typeof(Bar);
            Type typeFoo = typeof(Foo);

            Type foundType = Type2.GetInterface(typeBar, "Foo");

            Assert.IsNotNull(foundType);
            Assert.AreEqual(typeFoo.FullName, foundType.FullName);
            Assert.IsTrue(foundType.IsInterface);

            foundType = Type2.GetInterface(typeBar, "foo");
            Assert.IsNull(foundType);

            foundType = Type2.GetInterface(typeBar, "Qux");
            Assert.IsNull(foundType);

            foundType = Type2.GetInterface(typeBar, "foo", true);
            Assert.IsNotNull(foundType);
            Assert.AreEqual(typeFoo.FullName, foundType.FullName);
            Assert.IsTrue(foundType.IsInterface);

            foundType = Type2.GetInterface(typeBar, "qux", true);
            Assert.IsNull(foundType);
        }