1 // ****************************************************************
2 // This is free software licensed under the NUnit license. You
3 // may obtain a copy of the license as well as information regarding
4 // copyright ownership at http://nunit.org/?p=license&r=2.4.
5 // ****************************************************************
9 using System
.Reflection
;
14 /// SetUpFixture extends TestSuite and supports
15 /// Setup and TearDown methods.
17 public class SetUpFixture
: TestSuite
20 public SetUpFixture( Type type
) : base( type
)
22 this.TestName
.Name
= type
.Namespace
;
23 if (this.TestName
.Name
== null)
24 this.TestName
.Name
= "[default namespace]";
25 int index
= TestName
.Name
.LastIndexOf('.');
27 this.TestName
.Name
= this.TestName
.Name
.Substring(index
+ 1);
29 this.fixtureSetUp
= NUnitFramework
.GetSetUpMethod( type
);
30 this.fixtureTearDown
= NUnitFramework
.GetTearDownMethod( type
);
34 #region TestSuite Overrides
35 public override TestResult
Run(EventListener listener
, ITestFilter filter
)
37 using ( new DirectorySwapper( Path
.GetDirectoryName( TestFixtureBuilder
.GetAssemblyPath( FixtureType
) ) ) )
39 return base.Run(listener
, filter
);