Esempio n. 1
0
        public void CreateDelegateToMixin_returns_invokable_delegate()
        {
            var proxy  = new FakeProxyWithInvokeMethods();
            var action = ProxyUtil.CreateDelegateToMixin <Action>(proxy);

            action.Invoke();
        }
Esempio n. 2
0
        public void CreateDelegateToMixin_throws_MissingMethodException_if_no_suitable_Invoke_method_found()
        {
            var proxy = new FakeProxyWithInvokeMethods();

            Assert.Throws <MissingMethodException>(
                () => ProxyUtil.CreateDelegateToMixin <Action <bool> >(proxy)
                );
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        public void CreateDelegateToMixin_when_given_valid_arguments_succeeds()
        {
            var proxy = new FakeProxyWithInvokeMethods();

            Assert.NotNull(ProxyUtil.CreateDelegateToMixin(proxy, typeof(Action)));
        }