コード例 #1
0
        public void CreateInstance_ClassWithConstraintGenericMethod_HasSameBehavior()
        {
            var handler = ProxyTestHandlers.WriteMethodAndInvokeBaseHandler;
            var proxy   = new DirectProxyFactory <ListCreator <object> >(handler).CreateInstance();

            Assert.IsNotNull(proxy.Create <List <object> >());
        }
コード例 #2
0
        public void CreateInstance_ClassWithByRefReturnMethod_HasSameBehavior()
        {
            var handler = ProxyTestHandlers.WriteMethodAndInvokeBaseHandler;
            var proxy   = new DirectProxyFactory <ByRefValueBox <int> >(handler).CreateInstance();

            Assert.AreEqual(0, proxy.Value);
            ref var value = ref proxy.RefValue;
コード例 #3
0
        public void CreateInstance_AbstractClass_GetDefaultResult()
        {
            var handler = ProxyTestHandlers.WriteMethodAndReturnDefaultHandler;
            var proxy   = new DirectProxyFactory <EqualityComparer <object> >(handler).CreateInstance();

            Assert.AreEqual(false, proxy.Equals(0, 0));
        }
コード例 #4
0
        public void CreateInstance_ClassWithGenericMethod_HasSameBehavior()
        {
            var handler = ProxyTestHandlers.WriteMethodAndInvokeBaseHandler;
            var proxy   = new DirectProxyFactory <Creator>(handler).CreateInstance();

            Assert.IsNotNull(proxy.Create <object>());
            Assert.IsTrue(proxy.Equals(proxy));
        }
コード例 #5
0
        public void CreateInstance_ClassWithByRefParameterMethod_HasSameBehavior()
        {
            var handler = ProxyTestHandlers.WriteMethodAndInvokeBaseHandler;
            var proxy   = new DirectProxyFactory <Int32Increaser>(handler).CreateInstance();
            var value   = 0;

            proxy.Increase(ref value);
            Assert.AreEqual(1, value);
        }
コード例 #6
0
        public void CreateInstance_Interface_GetDefaultResult()
        {
            var handler = ProxyTestHandlers.WriteMethodAndReturnDefaultHandler;
            var proxy   = new DirectProxyFactory <IList <object> >(handler).CreateInstance();

            Assert.AreEqual(0, proxy.Count);
            for (int index = 0; index < 10; index++)
            {
                Assert.AreEqual(null, proxy[index]);
            }
        }
コード例 #7
0
        public void CreateInstance_Class_HasSameBehavior()
        {
            var handler = ProxyTestHandlers.WriteMethodAndInvokeBaseHandler;
            var proxy   = new DirectProxyFactory <Collection <int> >(handler).CreateInstance();

            for (int index = 0; index < 10; index++)
            {
                proxy.Add(index);
            }
            Assert.AreEqual(10, proxy.Count);
        }