You need to create an instance of the fixture in order to call the SetUp and TearDown methods.
On Oct 31, 2009, at 2:22 PM, Mark Kharitonov <[email protected]> wrote: > > I have found how to check within a SetUp/TearDown method whether the > current test is a TestSuite, so this is not a problem. > > However, I have difficulty writing dedicated SetUp/TearDown methods > for the dynamic TestCases. The problem is that the StaticTestFactory > method is static, but the type declaring that method declares SetUp/ > TearDown methods as instance methods, in order to let the derived > types override them, if necessary. The dynamically generated TestCases > must have the same SetUp/TearDown logic as the regular statically > compiled tests found in that type. But how can I refer to the > statically compiled SetUp/TearDown instance methods from the SetUp/ > TearDown delegates of the dynamically generated TestCase? > Thanks. > > On Oct 31, 10:41 pm, Mark Kharitonov <[email protected]> > wrote: >> Hi. >> Given: >> 1. A StaticTestFactory method belonging to a type declaring SetUp and >> TearDown methods. >> 2. Dynamically created TestSuite with several TestCases using the >> aforementioned StaticTestFactory method. Neither the generated >> TestSuite neither the generated TestCases define their own SetUp or >> TearDown. >> >> When I run the tests, I notice that the type's SetUp method is called >> just once - before the first TestCase, the same is true for the >> TearDown method - it is invoked just once, after the last TestCase. >> Is it by design or is there some kind of a problem? >> >> Should I implement dedicated SetUp/TearDown per each generated >> TestCase? >> >> Can I know from the type's SetUp/TearDown method that it is being >> invoked for a dynamically generated TestSuite? >> >> Thanks. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MbUnit.User" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/mbunituser?hl=en -~----------~----~----~----~------~----~------~--~---
