how to use [SetUp] and [TearDown] attributes in NUnit V2

Apr 14 2005 4:56 AM
Hi there, Need some help with using the [TearDown] and [SetUp] attributes in NUnit. There are two ways of using them: either as : [TestFixtureSetUp] and [TestFixtureTearDown] attributes either as : [SetUp] and [TearDown] attributes The first ones are used when you want a certain method to be run before/after any test are performed. The second ones are used when you want a certain method to be run before/after a test is run. The methods I'm testing are in a class named Calculus and the tests are in a class named MyTestUnit. I have the following problem : - if I use [TestFixtureSetUp] and [TestFixtureTearDown] attributes, in the [TestFixtureSetUp] method I write this code : Calculus myOp = new Calculus() and I don't know what to write in the [TestFixtureTearDown] method. The only way I can get MyTestUnit class to work is to put Calculus myOp = new Calculus() in each test method, but I don't like it this way. :( Plase help me . Any advice , piece of code or any hint appreciated. :) Thanks ;) Cheers, Adisor