Re: Testing event handling in an MS Office add-in

"Charlie Poole" <[email protected]> Fri, 8 Aug 2008 05:49:26 -0700
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <002e01c8f955$3233a180$6401a8c0@ferrari>
I believe you have already diagnosed the problem: the tests would
need to be running in an addin themselves in order to capture the
events. One of the goals of the NUnitLite project was to run in
exactly this environment, communicating with NUnit remotely.
Unfortunately, I had to set that project to the side temporarily.

If you are inclined to try, I suggest creating an addin that
runs tests of other addins - it will be a non-trivial
exercise of course. If you come up with something useable,
please let us know.

Charlie 

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf 
> Of Niklas Deutschmann
> Sent: Friday, August 08, 2008 12:46 AM
> To: [email protected]
> Subject: [Nunit-users] Testing event handling in an MS Office add-in
> 
> Hi,
> 
> I'm just trying to test some event handlers in a VSTO add-in 
> for Visio 2007.
> 
> In the method that is annotated with "TestFixtureSetUp", I 
> launch an instance of Visio:
> 
> Visio.Application app = new Visio.Application();
> 
> In the method annotated with "TestFixtureTearDown", I shut 
> down the running Visio instance:
> 
> app.Quit();
> 
> In the test methods, I create a diagram and manipulate it 
> using the Visio Automation API. I expect the diagram actions 
> to trigger the event handlers that are registered in the 
> startup method of the add-in. But there seems to be no event 
> handling at all, and in the NUnit's "Trace" 
> window, I don't even see any of my log messages that show 
> that the add-in is loaded.
> 
> However, when I remove the tear-down method, the Visio 
> instance remains open, I can work with the add-in without any 
> error, and  Visio is showing it as "loaded". So, the add-in 
> seems to be inactive only from the perspective of NUnit. Is 
> this caused by the different AppDomains for the add-in DLLs 
> in the test (that are loaded by NUnit) and the running Visio 
> instance (that may load a different copy of the add-in DLLs)? 
> How can I get Visio's event loop (I think this even applies 
> to other Office applications) "inside" the test?
> 
> Regards,
> Niklas
> 
> --------------------------------------------------------------
> -----------
> This SF.Net email is sponsored by the Moblin Your Move 
> Developer's challenge Build the coolest Linux based 
> applications with Moblin SDK & win great prizes Grand prize 
> is a trip for two to an Open Source event anywhere in the 
> world http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Nunit-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/nunit-users
> 



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/