예제 #1
0
 public void TestSubclassOfWithInterface()
 {
     RType iBarTy = new RType("IBar", RTypeAttributes.Interface);
     RType fooTy = new RType("Foo");
     fooTy.AddInterfaceImplementation(iBarTy);
     Assert.IsTrue(iBarTy.IsAssignable(fooTy));
 }
예제 #2
0
파일: TypeTest.cs 프로젝트: dubik/csharprpp
        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));
        }