예제 #1
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));
        }
예제 #2
0
        public void CreateProxyFromClassWithNonInterceptedMethodTest()
        {
            // Arrange
            var invocationHandler = new CountingInvocationHandler();

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

            proxy.Method();

            // Assert
            Assert.That(invocationHandler.InvocationCount, Is.EqualTo(0));
        }
예제 #3
0
        public void CreateProxyFromInterfaceWithNonInterceptedEventTest()
        {
            // Arrange
            var invocationHandler = new CountingInvocationHandler();

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

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

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