public void Mixin_with_derived_target_interface_forwards_base_to_target_derived_to_mixin() { var mixin = new ClassImplementingIDerivedSimpleMixin(); object proxy = generator.CreateInterfaceProxyWithTarget(typeof (ISimpleMixin), new SimpleMixin(), MixIn(mixin)); Assert.AreEqual(1, (proxy as ISimpleMixin).DoSomething()); Assert.AreEqual(2, (proxy as IDerivedSimpleMixin).DoSomethingDerived()); }
public void Mixin_with_derived_target_interface_forwards_base_to_target_derived_to_mixin() { var mixin = new ClassImplementingIDerivedSimpleMixin(); object proxy = generator.CreateInterfaceProxyWithTarget(typeof(ISimpleMixin), new SimpleMixin(), MixIn(mixin)); Assert.AreEqual(1, (proxy as ISimpleMixin).DoSomething()); Assert.AreEqual(2, (proxy as IDerivedSimpleMixin).DoSomethingDerived()); }
public void Mixin_with_derived_base_forwards_to_mixin() { var interceptor = new LogInvocationInterceptor(); var mixin = new ClassImplementingIDerivedSimpleMixin(); object proxy = generator.CreateClassProxy(typeof(SimpleMixin), new[] { typeof(IDerivedSimpleMixin) }, MixIn(mixin), interceptor); Assert.AreEqual(2, (proxy as IDerivedSimpleMixin).DoSomethingDerived()); Assert.IsNotEmpty(interceptor.Invocations); }
public void Mixin_same_as_additionalInterface_forwards_to_mixin() { var mixin = new ClassImplementingIDerivedSimpleMixin(); object proxy = generator.CreateInterfaceProxyWithTarget(typeof(ISimpleMixin), new[] { typeof(IDerivedSimpleMixin) }, new SimpleMixin(), MixIn(mixin)); Assert.AreEqual(1, (proxy as ISimpleMixin).DoSomething()); Assert.AreEqual(2, (proxy as IDerivedSimpleMixin).DoSomethingDerived()); }
public void Mixin_with_derived_base_forwards_to_mixin() { var interceptor = new LogInvocationInterceptor(); var mixin = new ClassImplementingIDerivedSimpleMixin(); object proxy = generator.CreateClassProxy(typeof(SimpleMixin), new[] { typeof(IDerivedSimpleMixin) }, MixIn(mixin), interceptor); Assert.AreEqual(2, (proxy as IDerivedSimpleMixin).DoSomethingDerived()); Assert.IsNotEmpty(interceptor.Invocations); }
public void Mixin_same_as_additionalInterface_forwards_to_mixin() { var mixin = new ClassImplementingIDerivedSimpleMixin(); object proxy = generator.CreateInterfaceProxyWithTarget(typeof (ISimpleMixin), new[] {typeof (IDerivedSimpleMixin)}, new SimpleMixin(), MixIn(mixin)); Assert.AreEqual(1, (proxy as ISimpleMixin).DoSomething()); Assert.AreEqual(2, (proxy as IDerivedSimpleMixin).DoSomethingDerived()); }