-
Notifications
You must be signed in to change notification settings - Fork 158
TestOf Attribute
Charlie Poole edited this page Jan 31, 2016
·
2 revisions
The TestOf attribute adds information about the class that is being tested. It can be applied to test fixtures and to tests.
The constructor takes the string name or the type of the class being tested. TestOf can also be specified on a TestFixture or Test attribute.
[TestFixture]
[TestOf(typeof(MyClass)]
public class MyTests
{
[Test]
public void Test1() { /* ... */ }
[Test]
[TestOf("MySubClass")]
public void Test2() { /* ... */ }
}
[TestFixture(TestOf = typeof(MyClass))]
public class MyOtherTests
{
[Test]
public void Test1() { /* ... */ }
[Test(TestOf = typeof(MySubClass))]
public void Test2() { /* ... */ }
}
Note: you can currently only have one TestOf attribute per fixture or test.
Copyright (c) 2018 The NUnit Project - Licensed under CC BY-NC-SA 4.0
-
NUnit
-
Release Notes
-
License
- Getting Started
- Writing Tests
- Running Tests
- Extending NUnit
- Technical Notes
-
Release Notes
- NUnit Xamarin Runners
- VS Test Adapter
- VS Test Generator
- NUnit Analyzers