示例#1
0
        public void TestInvokePaths()
        {
            var dynamically = ClayActivator.CreateInstance <Alpha>(new IClayBehavior[] {
                new InterfaceProxyBehavior(),
                new AlphaBehavior()
            });
            Alpha  statically    = dynamically;
            IAlpha interfacially = dynamically;

            Assert.That(dynamically.Hello(), Is.EqualTo("World-"));
            Assert.That(statically.Hello(), Is.EqualTo("World-"));
            Assert.That(interfacially.Hello(), Is.EqualTo("World-"));

            Assert.That(dynamically.Foo(), Is.EqualTo("Bar-"));
            Assert.That(interfacially.Foo(), Is.EqualTo("Bar-"));

            Assert.Throws <RuntimeBinderException>(() => dynamically.MissingNotHandled());
        }