Question

I am using VS2012 Fakes and MSTEST framework to do unit test. I have a third party dll and I need to fake it. However there is a method (getItemAt(int)) in the dll that seems to conflict with a method that exits in Fakes.

The error message I get during compile is:

Error 2 The type 'MyObject.Fakes.ShimList' already contains a definition for 'get_ItemAtInt32' [D:\Dev\Test\obj\Debug\Fakes\o\f.csproj] D:\Dev\Teste\f.cs 6933 111 Test

Any solution to pass by this error to continue work with Fakes?

Was it helpful?

Solution

It appears that the Fakes code generator breaks when trying to generate a shim for MyObject.List class in this third-party library. Could you submit this at http://connect.microsoft.com/VisualStudio? In the meantime, you can use the approach described here to generate only those stubs and shims you actually plan to use. Hopefully, that does not include the MyObject.List class.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top