public void CreateDelegateToMixin_returns_invokable_delegate() { var proxy = new FakeProxyWithInvokeMethods(); var action = ProxyUtil.CreateDelegateToMixin <Action>(proxy); action.Invoke(); }
public void CreateDelegateToMixin_throws_MissingMethodException_if_no_suitable_Invoke_method_found() { var proxy = new FakeProxyWithInvokeMethods(); Assert.Throws <MissingMethodException>( () => ProxyUtil.CreateDelegateToMixin <Action <bool> >(proxy) ); }
public void CreateDelegateToMixin_can_deal_with_multiple_Invoke_overloads() { var proxy = new FakeProxyWithInvokeMethods(); var action = ProxyUtil.CreateDelegateToMixin <Action>(proxy); action.Invoke(); Assert.AreEqual("Invoke()", proxy.LastInvocation); var intAction = ProxyUtil.CreateDelegateToMixin <Action <int> >(proxy); intAction.Invoke(42); Assert.AreEqual("Invoke(42)", proxy.LastInvocation); }
public void CreateDelegateToMixin_when_given_valid_arguments_succeeds() { var proxy = new FakeProxyWithInvokeMethods(); Assert.NotNull(ProxyUtil.CreateDelegateToMixin(proxy, typeof(Action))); }