I have the need to proxy the property types of a proxy. So the case would be:
I have interface IMyInterface:
public interface IMyInterface
{
public String Name {get; set;}
public Int Id {get;set;}
}
I can mock the interface just fine but I want to be able to mock, for instance, the Name property. I realize that String cannot be mocked because it is sealed. The functionality that I would like to see would be:
IMyInterfaceMock.Name.Equals()
should be handled by an Interceptor. I can't envision that this is even possible with the existing framework because I would be changing the type of the property but I was wondering if there was a clever way to achieve this. Is there any way I could interject into the proxy generation and modify the proxy's property's return type?
I don't think it's possible with DynamicProxy2 as it stands but I was wondering if anyone knew some magic.