Created
October 4, 2011 18:44
-
-
Save gbHeadspring/1262440 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using NUnit.Framework; | |
namespace NUnitLifecycle | |
{ | |
public abstract class TestBase : IDisposable | |
{ | |
protected TestBase() | |
{ | |
Console.WriteLine("Base Constructor"); | |
} | |
[TestFixtureSetUp] | |
public void BaseTestFixtureSetUp() | |
{ | |
Console.WriteLine("Base TestFixtureSetup"); | |
} | |
[TestFixtureTearDown] | |
public void BaseTestFixtureTearDown() | |
{ | |
Console.WriteLine("Base TestFixtureTearDown"); | |
} | |
[SetUp] | |
public void BaseTestSetUp() | |
{ | |
Console.WriteLine("Base SetUp"); | |
} | |
[TearDown] | |
public void BaseTestTearDown() | |
{ | |
Console.WriteLine("Base TearDown"); | |
} | |
[Test] | |
public void BaseFirstTest() | |
{ | |
Console.WriteLine("Base First Test passes!"); | |
Assert.Pass(); | |
} | |
[Test] | |
public void BaseSecondTest() | |
{ | |
Console.WriteLine("Base Second Test fails!"); | |
Assert.Fail(); | |
} | |
public virtual void Dispose() | |
{ | |
Console.WriteLine("Base Dispose"); | |
} | |
} | |
[TestFixture] | |
public class TestClass : TestBase | |
{ | |
public TestClass() | |
{ | |
Console.WriteLine("Derived Constructor"); | |
} | |
[TestFixtureSetUp] | |
public void TestClassSetUp() | |
{ | |
Console.WriteLine("Derived TestFixtureSetup"); | |
} | |
[TestFixtureTearDown] | |
public void TestClassTearDown() | |
{ | |
Console.WriteLine("Derived TestFixtureTearDown"); | |
} | |
[SetUp] | |
public void TestSetUp() | |
{ | |
Console.WriteLine("Derived SetUp"); | |
} | |
[TearDown] | |
public void TestTearDown() | |
{ | |
Console.WriteLine("Derived TearDown"); | |
} | |
[Test] | |
public void FirstTest() | |
{ | |
Console.WriteLine("Derived First Test passes!"); | |
Assert.Pass(); | |
} | |
[Test] | |
public void SecondTest() | |
{ | |
Console.WriteLine("Derived Second Test fails!"); | |
Assert.Fail(); | |
} | |
public override void Dispose() | |
{ | |
Console.WriteLine("Derived Dispose"); | |
base.Dispose(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment