2010-06-25 39 views

回答

6

不,它不会被调用。 IDisposable用于确定性定稿,通常与using陈述一起使用。但您可以拨打中的Dispose方法。

+0

注意'TestFixtureTearDown' **不会**如果被'TestFixtureSetUp'失败,调用或抛出异常: “只要任何TestFixtureSetUp方法没有错误运行时,TestFixtureTearDown方法是保证运行时也将如果TestFixtureSetUp方法失败或引发异常,则不运行。“ [NUnit TestFixtureTearDownAttribute Documentation](http://www.nunit.org/index.php?p=fixtureTeardown&r=2.6.4) – 2015-01-07 12:56:43

+2

从NUnit 2.4开始,将在您的TestFixture上调用Dispose(),以便给出另一个放置你的清理代码。 [2.4版发布说明](http://www.nunit.org/index.php?p=releaseNotes&r=2.4.1):“如果该对象实现了IDisposable,则在销毁之前调用Dispose” – vossad01 2015-02-22 17:35:00