public void TestSubclassOfWithInterface() { RType iBarTy = new RType("IBar", RTypeAttributes.Interface); RType fooTy = new RType("Foo"); fooTy.AddInterfaceImplementation(iBarTy); Assert.IsTrue(iBarTy.IsAssignable(fooTy)); }
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)); }