public void Initialize()
        {
            Baz baz = new Baz();

            foo = DuckType.Cast <Foo>(baz);
            Assert.AreNotSame(baz, foo);
        }
예제 #2
0
        public void EmptyMethodNoReturnType()
        {
            Baz baz = new Baz();
            Foo foo = DuckType.Cast <Foo>(baz);

            Assert.AreNotSame(baz, foo);
            foo.Bar();
        }
예제 #3
0
        public void CastToImplementedType()
        {
            Baz baz = new Baz();
            Foo foo = DuckType.Cast <Foo>(baz);

            Assert.AreSame(baz, foo);
            foo.Bar();
        }
        public void OverloadTestSameReturnTypes()
        {
            Baz  baz = new Baz();
            Quux foo = DuckType.Cast <Quux>(baz);

            Assert.AreNotSame(baz, foo);

            Assert.AreEqual("Hello World!", foo.Qux("Hello World!"));
            Assert.AreEqual("2", foo.Qux(2));
        }
        public void OverloadTestDifferentReturnTypes()
        {
            Baz baz = new Baz();
            Foo foo = DuckType.Cast <Foo>(baz);

            Assert.AreNotSame(baz, foo);

            Assert.AreEqual("Hello World!", foo.Bar("Hello"));
            Assert.AreEqual(4, foo.Bar(2));
            Assert.AreEqual(false, foo.Bar(true));
        }
        public void TestMethodParameters()
        {
            Baz baz = new Baz();
            Foo foo = DuckType.Cast <Foo>(baz);

            Assert.AreNotSame(baz, foo);
            foo.MethodString("test");
            foo.MethodInt(1337);
            foo.MethodBool(true);
            foo.MethodLong(1);
        }