How to mole System.dll

Problem: I get “no suitable method found to override” errors when I mole system.dll. Solution: Modify the System.moles file in your project and exclude everything except the types you are trying to mole. Explanation: I was trying to mole the SerialPort class in System.IO.Ports. After adding the mole for System.dll I began to get “no suitable method found to override” errors.  To resolve this issue I simply double clicked the System.moles file to open it in my IDE.  Then I modified the file so that moles were created only for the types under System.IO.  Change System.moles from this: <Moles xmlns="http://schemas.microsoft.com/moles/2010/">  <Assembly Name="System" /></Moles> to this: <Moles xmlns="http://schemas.microsoft.com/moles/2010/">   <Assembly Name="System" />   <StubGeneration>      <Types>         <Clear />         <Add Namespace="System.IO!" />      </Types>   </StubGeneration></Moles>

How to enable code coverage in my Team Build

Problem: I am not getting code coverage results in my build. Solution: Ensure you have a test settings file selected in your build definition. Explanation: On the process tab of your build definition expand the Automated Testing section under Basic and make sure the TestSettings File is pointing to the test settings file that has code coverage configured. You can watch a video below that demonstrates how to do this.

Demo Source Code

For those that wanted the demo code I presented today in the Web Cast it is here. It includes the code to databind a Coded UI Test. Thanks for joining me and I hope you enjoyed it. Demo.zip (408.41 kb)