TestFixtureSetUpAttribute (NUnit 2.1)
This attribute is used inside a TestFixture to provide a single set of
functions that are performed once prior to executing any of the tests
in the fixture. A TestFixture can have only one TestFixtureSetUp method.
If more than one is defined the TestFixture will compile successfully
but its tests will not run.
Example:
namespace NUnit.Tests
{
using System;
using NUnit.Framework;
[TestFixture]
public class SuccessTests
{
[TestFixtureSetUp] public void Init()
{ /* ... */ }
[TestFixtureTearDown] public void Dispose()
{ /* ... */ }
[Test] public void Add()
{ /* ... */ }
}
}
Imports System
Imports Nunit.Framework
Namespace Nunit.Tests
<TestFixture()> Public Class SuccessTests
<TestFixtureSetUp()> Public Sub Init()
' ...
End Sub
<TestFixtureTearDown()> Public Sub Dispose()
' ...
End Sub
<Test()> Public Sub Add()
' ...
End Sub
End Class
End Namespace
#using <Nunit.Framework.dll>
using namespace System;
using namespace NUnit::Framework;
namespace NUnitTests
{
[TestFixture]
public __gc class SuccessTests
{
[TestFixtureSetUp] void Init();
[TestFixtureTearDown] void Dispose();
[Test] void Add();
};
}
#include "cppsample.h"
namespace NUnitTests {
// ...
}
package NUnit.Tests;
import System.*;
import NUnit.Framework.TestFixture;
/** @attribute NUnit.Framework.TestFixture() */
public class SuccessTests
{
/** @attribute NUnit.Framework.TestFixtureSetUp() */
public void Init()
{ /* ... */ }
/** @attribute NUnit.Framework.TestFixtureTearDown() */
public void Dispose()
{ /* ... */ }
/** @attribute NUnit.Framework.Test() */
public void Add()
{ /* ... */ }
}