@@ -407,6 +407,57 @@ public void Can_proxy_interface_with_static_abstract_method()
407407
408408 #endregion
409409
410+ #region Mixins
411+
412+ [ Test ]
413+ public void Can_intercept_method_with_default_implementation_from_mixin_in_proxied_class ( )
414+ {
415+ var options = new ProxyGenerationOptions ( ) ;
416+ options . AddMixinInstance ( new InheritsMethodWithDefaultImplementation ( ) ) ;
417+ var expected = "intercepted" ;
418+ var interceptor = new WithCallbackInterceptor ( invocation => invocation . ReturnValue = expected ) ;
419+ var proxy = generator . CreateClassProxy ( typeof ( object ) , options , interceptor ) ;
420+ var actual = ( ( IHaveMethodWithDefaultImplementation ) proxy ) . MethodWithDefaultImplementation ( ) ;
421+ Assert . AreEqual ( expected , actual ) ;
422+ }
423+
424+ [ Test ]
425+ public void Can_intercept_method_with_default_implementation_from_mixin_in_proxied_interface ( )
426+ {
427+ var options = new ProxyGenerationOptions ( ) ;
428+ options . AddMixinInstance ( new InheritsMethodWithDefaultImplementation ( ) ) ;
429+ var expected = "intercepted" ;
430+ var interceptor = new WithCallbackInterceptor ( invocation => invocation . ReturnValue = expected ) ;
431+ var proxy = generator . CreateInterfaceProxyWithoutTarget ( typeof ( IEmpty ) , options , interceptor ) ;
432+ var actual = ( ( IHaveMethodWithDefaultImplementation ) proxy ) . MethodWithDefaultImplementation ( ) ;
433+ Assert . AreEqual ( expected , actual ) ;
434+ }
435+
436+ [ Test ]
437+ public void Can_proceed_to_method_default_implementation_from_mixin_in_proxied_class ( )
438+ {
439+ var options = new ProxyGenerationOptions ( ) ;
440+ options . AddMixinInstance ( new InheritsMethodWithDefaultImplementation ( ) ) ;
441+ var interceptor = new WithCallbackInterceptor ( invocation => invocation . Proceed ( ) ) ;
442+ var proxy = generator . CreateClassProxy ( typeof ( object ) , options , interceptor ) ;
443+ var expected = "default implementation" ;
444+ var actual = ( ( IHaveMethodWithDefaultImplementation ) proxy ) . MethodWithDefaultImplementation ( ) ;
445+ Assert . AreEqual ( expected , actual ) ;
446+ }
447+
448+ [ Test ]
449+ public void Can_proceed_to_method_default_implementation_from_mixin_in_proxied_interface ( )
450+ {
451+ var options = new ProxyGenerationOptions ( ) ;
452+ options . AddMixinInstance ( new InheritsMethodWithDefaultImplementation ( ) ) ;
453+ var interceptor = new WithCallbackInterceptor ( invocation => invocation . Proceed ( ) ) ;
454+ var proxy = generator . CreateInterfaceProxyWithoutTarget ( typeof ( IEmpty ) , options , interceptor ) ;
455+ var expected = "default implementation" ;
456+ var actual = ( ( IHaveMethodWithDefaultImplementation ) proxy ) . MethodWithDefaultImplementation ( ) ;
457+ Assert . AreEqual ( expected , actual ) ;
458+ }
459+ #endregion
460+
410461 public interface IHaveGenericMethodWithDefaultImplementation
411462 {
412463 string GenericMethodWithDefaultImplementation < T > ( )
0 commit comments