Exemple #1
0
        public void AddProxyCanBeCalledMoreThanOnce() {
            var context = new DynamicProxyContext();
            context.AddProxy(typeof(SimpleComponent));

            Type proxyType;
            Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.True);
            Assert.That(proxyType, Is.Not.Null);

            Type proxyType2;
            context.AddProxy(typeof(SimpleComponent));
            Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType2), Is.True);

            Assert.That(proxyType2, Is.SameAs(proxyType));
        }
        public void AddProxyCanBeCalledMoreThanOnce()
        {
            var context = new DynamicProxyContext();

            context.AddProxy(typeof(SimpleComponent));

            Type proxyType;

            Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.True);
            Assert.That(proxyType, Is.Not.Null);

            Type proxyType2;

            context.AddProxy(typeof(SimpleComponent));
            Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType2), Is.True);

            Assert.That(proxyType2, Is.SameAs(proxyType));
        }
Exemple #3
0
        public void ProxyContextReturnsTrueIfTypeHasBeenProxied() {
            var context = new DynamicProxyContext();

            Type proxyType;
            Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.False);
            Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.False);
            Assert.That(proxyType, Is.Null);

            context.AddProxy(typeof(SimpleComponent));
            Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.True);
            Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.True);
            Assert.That(proxyType, Is.Not.Null);
        }
        public void ProxyContextReturnsTrueIfTypeHasBeenProxied()
        {
            var context = new DynamicProxyContext();

            Type proxyType;

            Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.False);
            Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.False);
            Assert.That(proxyType, Is.Null);

            context.AddProxy(typeof(SimpleComponent));
            Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.True);
            Assert.That(context.TryGetProxy(typeof(SimpleComponent), out proxyType), Is.True);
            Assert.That(proxyType, Is.Not.Null);
        }