I have a build configured with CI post which some tests are run. Although the tests run successfully, the build shows warnings:
: Cannot generate stub for StructuremapMvc: type is sealed. : Cannot generate shim for IUnitOfWork: type is an interface. : Cannot generate shim for Repository.IRepository`1: type is an interface.
and so on.
I am using a generic repository pattern along with Unit Of Work. I have added Fake Assemblies for my MVC WebApi project (which leverages Dependency Injection using StructureMap) and Data project which contains my Repositories and UnitOfWork. I have explored this error and seem somewhat convinced that this maybe due to limitations of the Fake Assemblies, but I need to be absolutely sure that I am not doing anything wrong
The way I got rid of these warnings was to only create the shims which are needed. I added the following to the fakes config file.
<ShimGeneration>
<Clear/>
<Add FullName="ATypeToShim!"/>
<Add FullName="AnotherTypeToShim!"/>
</ShimGeneration>
The ! at the end of the filter makes it a precise case-sensitive match.
For stubs, I only ever stub interfaces so its easy:
<StubGeneration>
<Clear />
<Add Interfaces ="true"/>
</StubGeneration>
There are more details here: http://msdn.microsoft.com/en-us/library/hh708916.aspx#bkmk_type_filtering