views:

199

answers:

2

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.

+2  A: 

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).

Florian
+2  A: 

I think it will be hard to tell right away what you will want to be done inside those methods, specially if you have never worked with it.

I would wait on those tests, right until I start needing code to go in there. When I start hooking code in there, I would test just that - whether the code that is hooking the other stuff is correct (unit tests for those other pieces would already be in).

eglasius