示例#1
0
        public void TestIsInstanceOfClassWhichImplementsInterface()
        {
            RType interfaceTy = new RType("IBar", RTypeAttributes.Interface);
            RType fooTy = new RType("Foo");
            fooTy.AddInterfaceImplementation(interfaceTy);

            Assert.IsTrue(fooTy.IsInstanceOf(interfaceTy));
            RType anotherInterfaceTy = new RType("IBar", RTypeAttributes.Interface);
            Assert.IsTrue(fooTy.IsInstanceOf(anotherInterfaceTy));

            RType wrongInterfaceTy = new RType("IFoo", RTypeAttributes.Interface);
            Assert.IsFalse(fooTy.IsInstanceOf(wrongInterfaceTy));
        }
示例#2
0
 public void TestIsInstanceOfSimpleClass()
 {
     RType fooTy = new RType("Foo", RTypeAttributes.Class, AnyTy);
     Assert.IsTrue(fooTy.IsInstanceOf(AnyTy));
     Assert.IsFalse(fooTy.IsInstanceOf(StringTy));
 }