2010-06-25 38 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