Beispiel #1
0
        public void GetProxyType_IsCached()
        {
            var provider = new StableBindingProxyProvider(
                new TypeLevelTypeFilter(new[] { typeof(GetProxyTypeIsCachedTest) }), CreateModuleScope("BuildProxy"));

            var proxied = new GetProxyTypeIsCachedTest("abrakadava");

            var proxyType = provider.GetProxyType(proxied.GetType());

            Assert.That(proxyType, Is.Not.Null);
            Assert.That(provider.GetProxyType(proxied.GetType()), Is.SameAs(proxyType));
        }
Beispiel #2
0
        public void GetProxy_IsCached()
        {
            var provider = new StableBindingProxyProvider(
                new TypeLevelTypeFilter(new[] { typeof(GetProxyTypeIsCachedTest) }), CreateModuleScope("BuildProxy"));

            var proxied0 = new GetProxyTypeIsCachedTest("abrakadava");
            var proxied1 = new GetProxyTypeIsCachedTest("simsalsabum");

            var proxy0 = provider.GetProxy(proxied0);

            Assert.That(proxy0, Is.Not.Null);
            var proxy1 = provider.GetProxy(proxied1);

            Assert.That(proxy0, Is.SameAs(proxy1));
        }
Beispiel #3
0
        public void GetProxy_IsCachedAndProxiedIsSet()
        {
            var provider = new StableBindingProxyProvider(
                new TypeLevelTypeFilter(new[] { typeof(GetProxyTypeIsCachedTest) }), CreateModuleScope("GetProxy_IsCachedAndProxiedSet"));

            var proxied0 = new GetProxyTypeIsCachedTest("abrakadava");
            var proxied1 = new GetProxyTypeIsCachedTest("simsalsabum");

            var proxy0 = provider.GetProxy(proxied0);

            Assert.That(proxy0, Is.Not.Null);

            var proxiedFieldValue0 = ScriptingHelper.GetProxiedFieldValue(proxy0);

            Assert.That(proxiedFieldValue0, Is.SameAs(proxied0));
            var proxy1 = provider.GetProxy(proxied1);

            Assert.That(proxy0, Is.SameAs(proxy1));
            Assert.That(ScriptingHelper.GetProxiedFieldValue(proxy1), Is.SameAs(proxied1));
        }