コード例 #1
0
ファイル: GoInterfaceTests.cs プロジェクト: dadhi/ecsharp
        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");
        }
コード例 #2
0
 public void DoBaz() => _baz.Baz();