What steps will reproduce the problem?
I am using Autofixture (3.19.2) and Moq (4.2.1408.717). Autofixture
automatically sets CallBase = true on mock objects it creates.
I have the following interfaces:
public interface IFileWrapper
{
DirectoryInfo CreateDirectory( string path );
bool FileExists( string path );
}
public interface ISerializer : IFileWrapper
{
string Serialize<T>( T data );
T Deserialize<T>( string data );
void SerializeToFile<T>( T data, string fileName );
T DeserializeFromFile<T>( string fileName );
}
When autofixture (via AutoMoq) creates a Mock<ISerializer> and tries to call
.CreateDirectory on it, the following exception is thrown:
This is a DynamicProxy2 error: The interceptor attempted to 'Proceed' for
method 'System.IO.DirectoryInfo CreateDirectory(System.String)' which has no
target. When calling method without target there is no implementation to
'proceed' to and it is the responsibility of the interceptor to mimic the
implementation (set return value, out arguments etc)
What is the expected output? What do you see instead?
I expected it to act as if it were a single interface (inherited members
treated the same). I'm not sure if this is the default behavior with CallBase
= true or not.
I noticed this other issue with the same exception:
https://code.google.com/p/moq/issues/detail?id=325
but there is no inheritance involved and I'm not using events, so I didn't know
if it was related.
Original issue reported on code.google.com by execra...@gmail.com on 12 Aug 2014 at 7:32
Original issue reported on code.google.com by
execra...@gmail.com
on 12 Aug 2014 at 7:32