Visual-studio – TDD in Visual Studio 2008 add-ins

tddvisual-studio-addins

I am trying to create an addin for Excel using Visual Studio 2008 and I would like to use Test Driven Development (TDD).

Pure TDD would start from an empty solution.
The following methods are autogenerated when creating a shared addin project:

public class Connect
{  
  public Connect(){ }  

  public void OnAddInsUpdate(ref System.Array custom){ }  

  public void OnBeginShutdown(ref System.Array custom){ }  

  public void OnConnection(  
        object application  
        , Extensibility.ext_ConnectMode  
        , connectMode  
        , object addInInst  
        , ref System.Array custom)  
  {
     applicationObject = application;
     addInInstance = addInInst;
  }  

  public void OnDisconnection(  
       Extensibility.ext_DisconnectMode disconnectMode  
       , ref System.Array custom){ }  

  public void OnStartupComplete(ref System.Array custom){ }  
}  

How do I test these methods before actual writing any of my code for the addin?
The addin will have a class WorkSheet.cs

Freddy: I was thinking of instantiating the classes within the generated code, write a test against the creation of the object, and continue from there.

Best Answer

The code is generated by a framework and as such does not require testing. I would propose to exclude this code from code coverage (if you use that).

Related Topic