<PackageReference Include="NUnit" Version="3.0.0-alpha-3" />

TestFixtureAttribute

using NUnit.Framework.Interfaces; using NUnit.Framework.Internal; using NUnit.Framework.Internal.Builders; using System; using System.Collections; namespace NUnit.Framework { [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public class TestFixtureAttribute : FixtureBuilderAttribute, IFixtureBuilder, IApplyToTest { private readonly NUnitTestFixtureBuilder builder = new NUnitTestFixtureBuilder(); private string _ignoreReason; public string Description { get; set; } public string Author { get; set; } public Type TestOf { get; set; } public object[] Arguments { get; set; } public bool Ignore { get; set; } public string IgnoreReason { get { return _ignoreReason; } set { _ignoreReason = value; Ignore = !string.IsNullOrEmpty(_ignoreReason); } } public Type[] TypeArgs { get; set; } public string Category { get; set; } public IList Categories { get { if (Category != null) return Category.Split(new char[1] { ',' }); return null; } } public TestFixtureAttribute() : this(new object[0]) { } public TestFixtureAttribute(params object[] arguments) { Arguments = arguments; TypeArgs = new Type[0]; } public void ApplyToTest(Test test) { if (!test.Properties.ContainsKey("Description") && Description != null) test.Properties.Set("Description", Description); if (!test.Properties.ContainsKey("Author") && Author != null) test.Properties.Set("Author", Author); if (!test.Properties.ContainsKey("TestOf") && TestOf != (Type)null) test.Properties.Set("TestOf", TestOf.FullName); if (Category != null) { string[] array = Category.Split(new char[1] { ',' }); foreach (string value in array) { test.Properties.Add("Category", value); } } } public TestSuite BuildFrom(Type type) { return builder.BuildFrom(type, this); } } }