GlobalGameJame/Library/PackageCache/com.unity.test-framework@1.1.9/UnityEngine.TestRunner/Utils/TestRunCallbackAttribute.cs

25 lines
730 B
C#
Raw Normal View History

2020-01-31 15:10:04 +00:00
using System;
namespace UnityEngine.TestRunner
{
[AttributeUsage(AttributeTargets.Assembly)]
public class TestRunCallbackAttribute : Attribute
{
private Type m_Type;
public TestRunCallbackAttribute(Type type)
{
var interfaceType = typeof(ITestRunCallback);
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 ITestRunCallback ConstructCallback()
{
return Activator.CreateInstance(m_Type) as ITestRunCallback;
}
}
}