I have been able to run some relatively simple unit tests (calling the VB .NET ArcObjects api with NUnit 2.5.7) and am sharing my findings since information on this topic is sparse.
In the TestFixtureSetUp() sub you need to use the AoInitialize Interface to initialize the test application with a suitable license. I think this requirement was added in 9.2. Private m_ao As ESRI.ArcGIS.esriSystem.IAoInitialize m_ao = New ESRI.ArcGIS.esriSystem.AoInitialize() m_ao.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcInfo)
Starting in ArcGIS 10, you also need to bind to a particular ArcGIS product before calling ArcObjects code. I included this call in TestFixtureSetUp() method as well. Dim bound As Boolean = ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop)
Be sure to shutdown the IAOInitialize interface and the IApplication interface (if it was created) in the TestFixtureTearDown() sub. Shutting down the IAOInitialize interface should be the last call to ArcObjects in an application. If m_application IsNot Nothing Then Dim docDirtyFlag As IDocumentDirty2 = DirectCast(m_application.Document, IDocumentDirty2) docDirtyFlag.SetClean() m_application.Shutdown() End If m_ao.Shutdown()