I have the following interfaces:
interface IFoo {}
interface IBar {
IFoo Foo {get;set;}
}
Given a generated proxy implementation
var generator = new ProxyGenerator();
var proxy = generator.CreateInterfaceProxyWithoutTarget<IBar>();
Is there a way to have the property Foo
of proxy
have its instance mocked and initialized such that
Assert.IsNotNull(proxy.Foo);
?
No.
The proxy wont have backing fields for the properties. Its sole purpose is to invoke the interceptor chain, so it's up on of your interceptors to return a value for the property.