The Issue
We’ve got a VSTO Word Add-in that we’re trying to do integration tests with.
We’ve organised into 3 projects as follows:
- VSTO Project
- Business Logic Project
- Test Project
The issue is that in the test integration project we can create an instance of word using new Microsoft.Office.Interop.Word.Application() however we are unable to get an instance of Microsoft.Office.Tools.Word.ApplicationFactory (VSTO interface).
Does anyone know how I can get an instance of the VSTO ApplicationFactory in a test assembly?
For reference
The VSTO project makes calls to the business logic project passing
- Microsoft.Office.Interop.Word.Application
- Microsoft.Office.Tools.Word.ApplicationFactory
In the business logic project we can get the active Microsoft.Office.Interop.Word.Document and call the interop document method GetVstoObject method passing in the factory
public Microsoft.Office.Tools.Word.Document VstoDocument
{
get { return _document.GetVstoObject(_factory); }
}