1 | // ****************************************************************
|
---|
2 | // Copyright 2007, Charlie Poole
|
---|
3 | // This is free software licensed under the NUnit license. You may
|
---|
4 | // obtain a copy of the license at http://nunit.org/?p=license&r=2.4
|
---|
5 | // ****************************************************************
|
---|
6 |
|
---|
7 | using System;
|
---|
8 |
|
---|
9 | namespace NUnit.Core.Extensions
|
---|
10 | {
|
---|
11 | /// <summary>
|
---|
12 | /// SampleFixtureExtension extends NUnitTestFixture and adds a custom setup
|
---|
13 | /// before running TestFixtureSetUp and after running TestFixtureTearDown.
|
---|
14 | /// Because it inherits from NUnitTestFixture, a lot of work is done for it.
|
---|
15 | /// </summary>
|
---|
16 | class SampleFixtureExtension : NUnitTestFixture
|
---|
17 | {
|
---|
18 | public SampleFixtureExtension( Type fixtureType )
|
---|
19 | : base( fixtureType )
|
---|
20 | {
|
---|
21 | // NOTE: Since we are inheriting from NUnitTestFixture we don't
|
---|
22 | // have to do anything if we don't want to. All the attributes
|
---|
23 | // that are normally used with an NUnitTestFixture will be
|
---|
24 | // recognized.
|
---|
25 | //
|
---|
26 | // Just to have something to do, we override DoOneTimeSetUp and
|
---|
27 | // DoOneTimeTearDown below to do some special processing before
|
---|
28 | // and after the normal TestFixtureSetUp and TestFixtureTearDown.
|
---|
29 | // In this example, we simply display a message.
|
---|
30 | }
|
---|
31 |
|
---|
32 | protected override void DoOneTimeSetUp(TestResult suiteResult)
|
---|
33 | {
|
---|
34 | Console.WriteLine( "Extended Fixture SetUp called" );
|
---|
35 | base.DoOneTimeSetUp (suiteResult);
|
---|
36 | }
|
---|
37 |
|
---|
38 | protected override void DoOneTimeTearDown(TestResult suiteResult)
|
---|
39 | {
|
---|
40 | base.DoOneTimeTearDown (suiteResult);
|
---|
41 | Console.WriteLine( "Extended Fixture TearDown called" );
|
---|
42 | }
|
---|
43 | }
|
---|
44 | }
|
---|