private static TypeMetadata BuildProxyMetadata()
        {
            var interfaceDefinition = new NonTargetedInterfaceDefinition(typeof(IShape));

            var definition = new ClassProxyDefinition(typeof(Square), new [] { interfaceDefinition });
            var metadataBuilder = new ClassProxyMetadataBuilder(definition);

            return metadataBuilder.Build();
        }
예제 #2
0
        public void CanBuildSubClassProxy()
        {
            var proxyDefinition = new ClassProxyDefinition(typeof(Square), null);

            var type = _builder.Build(proxyDefinition);

            Assert.IsNotNull(type);
            Assert.That(typeof(Square).IsAssignableFrom(type));
        }
예제 #3
0
        public void CanBuildSubClassProxyWithDuckType()
        {
            var duckTypeDefinition = new DuckTypeInterfaceDefinition(typeof(IShape));
            var interfaces = new InterfaceDefinition[] { duckTypeDefinition };
            var proxyDefinition = new ClassProxyDefinition(typeof(Square), interfaces);

            var type = _builder.Build(proxyDefinition);

            Assert.IsNotNull(type);
            Assert.That(typeof(Square).IsAssignableFrom(type));
            Assert.That(typeof(IShape).IsAssignableFrom(type));
        }
        private ProxyDefinition CreateProxyDefinitionWithInterface1()
        {
            var interfaceDefinition = new MixinInterfaceDefinition(
                typeof(INotifyPropertyChanged),
                typeof(NotifyPropertyChangedMixin),
                false);

            var proxyDefinition = new ClassProxyDefinition(
                typeof(Square),
                new InterfaceDefinition[] { interfaceDefinition });

            return proxyDefinition;
        }
예제 #5
0
        public void CanBuildSubClassProxyWithTargetedMixin()
        {
            var mixinDefinition = new MixinInterfaceDefinition(
                typeof(INotifyPropertyChanged),
                typeof(NotifyPropertyChangedMixin),
                false);

            var interfaces = new InterfaceDefinition[] { mixinDefinition };
            var proxyDefinition = new ClassProxyDefinition(typeof(Square), interfaces);

            var type = _builder.Build(proxyDefinition);

            Assert.IsNotNull(type);
            Assert.That(typeof(Square).IsAssignableFrom(type));
            Assert.That(typeof(INotifyPropertyChanged).IsAssignableFrom(type));
        }
        private static TypeMetadata BuildProxyMetadata()
        {
            var definition = new ClassProxyDefinition(typeof(Square), null);
            var metadataBuilder = new ClassProxyMetadataBuilder(definition);

            return metadataBuilder.Build();
        }
        private ProxyDefinition CreateProxyDefinitionWithInterface2()
        {
            var interfaceDefinition = new NonTargetedInterfaceDefinition(typeof(ISquare));

            var proxyDefinition = new ClassProxyDefinition(
                typeof(Shape),
                new InterfaceDefinition[] { interfaceDefinition });

            return proxyDefinition;
        }