views:

17

answers:

1

If I create an IDisposable during the TestFixtureSetup of an NUnit test, and the test throws an unanticipated exception (e.g. external resource fails), will the IDisposable's Dispose() get called?

Added>>
If not, does NUnit provide guaranteed execution of TestFixtureTearDown or somewhere else that can be used for cleanup?

+3  A: 

No it won't be called. IDisposable is used for deterministic finalization usually used in conjunction with the using statement. You could call the Dispose method in the TestFixtureTearDown though.

Darin Dimitrov