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(); }
public void CanBuildSubClassProxy() { var proxyDefinition = new ClassProxyDefinition(typeof(Square), null); var type = _builder.Build(proxyDefinition); Assert.IsNotNull(type); Assert.That(typeof(Square).IsAssignableFrom(type)); }
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; }
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; }