This repository was archived by the owner on Jun 30, 2023. It is now read-only.

Description
By default when you create new Mock, you cannot use existing class instance - meanwhile in Moq v 4 - I've noticed that Castle.DynamicProxy.ProxyGenerator supports providing existing class instance - you can use either CreateInterfaceProxyWithTarget or CreateClassProxyWithTarget - and proxy existing class instance.
I do understand that Moq v5 is slightly different than Moq v4 - but I think its possible to use same concept as well.
So maybe there should be alternative constructor:
class Mock<T>...
Mock(T t); // Use by default all methods from t unless overridden by Setup function call.
Which would allow to pass class instance to be proxied.
This feature would be useful in case if want to use majority of same functionality as T defines, by maybe override by couple of methods via Setup.