using System; namespace UnityEditor.TestTools { /// /// The `TestPlayerBuildModifierAttribute` attribute can be applied to test assemblies (will affect every test in the assembly). /// [AttributeUsage(AttributeTargets.Assembly)] public class TestPlayerBuildModifierAttribute : Attribute { private Type m_Type; /// /// Initializes and returns an instance of TestPlayerBuildModifierAttribute or throws an . /// /// /// Throws a if the type provided does not implemented the `ITestPlayerBuildModifier` interface. public TestPlayerBuildModifierAttribute(Type type) { var interfaceType = typeof(ITestPlayerBuildModifier); if (!interfaceType.IsAssignableFrom(type)) { throw new ArgumentException(string.Format("Type provided to {0} does not implement {1}", this.GetType().Name, interfaceType.Name)); } m_Type = type; } internal ITestPlayerBuildModifier ConstructModifier() { return Activator.CreateInstance(m_Type) as ITestPlayerBuildModifier; } } }