Last active
April 24, 2018 13:33
-
-
Save geirsagberg/2585edb49b518d0bf5343a7c357e0642 to your computer and use it in GitHub Desktop.
xUnit integration test trait attribute
This file contains hidden or 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.Collections.Generic; | |
using Xunit.Abstractions; | |
using Xunit.Sdk; | |
namespace MyProject.TestUtils | |
{ | |
public class IntegrationTestDiscoverer : ITraitDiscoverer | |
{ | |
internal const string DiscovererTypeName = nameof(MyProject) + "." + nameof(TestUtils) + "." + nameof(IntegrationTestDiscoverer); | |
public IEnumerable<KeyValuePair<string, string>> GetTraits(IAttributeInfo traitAttribute) | |
{ | |
yield return new KeyValuePair<string, string>("Category", "IntegrationTest"); | |
} | |
} | |
[TraitDiscoverer(IntegrationTestDiscoverer.DiscovererTypeName, nameof(MyProject) + "." + nameof(TestUtils))] | |
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)] | |
public class IntegrationTestAttribute : Attribute, ITraitAttribute | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment