public void ProxyGenerator_CreateInterfaceProxyWithTarget_can_proceed_to_delegate_mixin() { var target = new Target(); var options = new ProxyGenerationOptions(); options.AddDelegateMixin(new Action(target.Method)); var interceptor = new Interceptor(shouldProceed: true); var proxy = generator.CreateInterfaceProxyWithTarget(typeof(IComparable), target, options, interceptor); var action = ProxyUtil.CreateDelegateToMixin <Action>(proxy); Assert.NotNull(action); action.Invoke(); Assert.True(target.MethodInvoked); }
public void ProxyGenerationOptions_AddDelegateMixin_when_given_delegate_succeeds() { var options = new ProxyGenerationOptions(); options.AddDelegateMixin(new Action(() => { })); }
public void ProxyGenerationOptions_AddDelegateMixin_when_given_null_throws_ArgumentNullException() { var options = new ProxyGenerationOptions(); Assert.Throws <ArgumentNullException>(() => options.AddDelegateMixin(null)); }