示例#1
0
        public void InheritanceTest()
        {
            object  something = new FooB();
            FooBase foo       = GoInterface <FooBase> .From(something);

            Assert.That(foo.Foo() == "Foo");
            Assert.That(foo.Bar() == "Bar");
            Assert.That(foo.Baz(1) == "Baz");
            Assert.That(((IBaz)foo).Baz(false) == "Baz");
            Assert.That(foo.Baz() == "Baz");

            something = new FooB();
            IBaz baz = GoInterface <IBaz> .ForceFrom(something);

            Assert.That(((IBar)baz).Bar() == "Bar");
            Assert.That(((IBar2)baz).Bar() == "Bar");
            Assert.That(baz.Baz() == "Baz");
        }
 public void DoBaz() => _baz.Baz();