First I started by creating an assembly to be used from NUnit GUI. Some tests failed without an obvious reason. After some research I understood that the COM apartment must be STAThread. The threading model must be set before the thread is started but I don't have access to NUnit GUI main thread from my assembly.
One possible solution to this problem is to transform the assembly into an EXE application that uses the NUnit framework like this:
[STAThread]When /nothread command line flag is used the tests are executed by the main thread which already has the right COM apartment properly set.
public static void Main(string[] args)
{
NUnit.ConsoleRunner.Runner.Main(
new string[] { System.AppDomain.CurrentDomain.BaseDirectory + "MyExe.exe", "/nothread" });
}