Inheritance: IInvocationHandler
Ejemplo n.º 1
0
        public void CreateProxyFromInterfaceWithNonInterceptedMethodTest()
        {
            // Arrange
            var invocationHandler = new CountingInvocationHandler();

            // Act
            var proxy = _proxyFactory.CreateProxy<INonIntercepted>(Type.EmptyTypes, invocationHandler);

            proxy.Method();

            // Assert
            Assert.That(invocationHandler.InvocationCount, Is.EqualTo(1));
        }
Ejemplo n.º 2
0
        public void CreateProxyFromAbstractClassWithNonInterceptedPropertyTest()
        {
            // Arrange
            var invocationHandler = new CountingInvocationHandler();

            // Act
            var proxy = _proxyFactory.CreateProxy<NonInterceptedBase>(Type.EmptyTypes, invocationHandler);

            proxy.Property = default(int);

            // Assert
            Assert.That(invocationHandler.InvocationCount, Is.EqualTo(1));
        }
Ejemplo n.º 3
0
        public void CreateProxyFromClassWithNonInterceptedEventTest()
        {
            // Arrange
            var invocationHandler = new CountingInvocationHandler();

            // Act
            var proxy = _proxyFactory.CreateProxy<NonIntercepted>(Type.EmptyTypes, invocationHandler);

            proxy.Event += () => { };

            // Assert
            Assert.That(invocationHandler.InvocationCount, Is.EqualTo(0));
        }