-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDecorator.cs
39 lines (35 loc) · 1.06 KB
/
Decorator.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// This is something we'll provide in a separate assembly as a library
namespace Launchable {
using System;
using NUnit.Framework.Interfaces;
using NUnit.Framework.Internal;
/// <summary>
/// Subset tests within this assembly
/// </summary>
[AttributeUsage(AttributeTargets.Assembly)]
public class LaunchableAttribute : Attribute, IApplyToTest
{
public void ApplyToTest(Test test)
{
Walk(test);
}
private void Walk(Test t)
{
Process(t);
foreach (Test c in t.Tests)
{
Walk(c);
}
}
// Example of inspecting a test and applying a custom filtering mechanism
// see https://github.com/nunit/nunit/blob/master/src/NUnitFramework/framework/Internal/Tests/Test.cs
private void Process(Test t)
{
Console.WriteLine("Examining: "+t.FullName);
if (t.FullName.EndsWith("Test2"))
{
t.RunState = RunState.Skipped;
}
}
}
}