I have a .net 4 application that references a COM dll. It works fine using an app.manifest with GUIDs.
However, when I try to execute a unit test, the executable is QTAgent32.exe and I don't know how to allow it to load the COM class: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {81273702-956F-4CBD-9B16-43790558EE29} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
Can I use a manifest for QTAgent32?
I would recommend just making the ServicedComponent (the COM+ class) a this wrapper for the class actually performing the logic, and then perform the unit test on this class.
If your class is dependent on an external runtime environment, it is not generally possible to unit test it. A unit test should not depend on any external environment, be it IIS, file system, database, COM+, etc. Imho.
For a Unit Test - that uses external resources ie Database - to deploy successfully, you will have to define the TestCategory of Integration as below
[TestCategory("Integration")]
User contributions licensed under CC BY-SA 3.0