Rasagar/Library/PackageCache/com.unity.test-framework.performance/Runtime/Attributes/VersionAttribute.cs

38 lines
1.0 KiB
C#
Raw Normal View History

2024-08-26 13:07:20 -07:00
using System;
using NUnit.Framework;
using NUnit.Framework.Interfaces;
using NUnit.Framework.Internal;
namespace Unity.PerformanceTesting
{
/// <summary>
/// Test attribute to specify test version.
/// </summary>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
public class VersionAttribute : NUnitAttribute, IApplyToTest
{
/// <summary>
/// Test version.
/// </summary>
public string Version { get; }
/// <summary>
/// Adds attribute to specify test version.
/// </summary>
/// <param name="version">Version of the test.</param>
public VersionAttribute(string version)
{
Version = version;
}
/// <summary>
/// Used by NUnit to apply version to properties.
/// </summary>
/// <param name="test">An NUnit test to apply the version property to.</param>
public void ApplyToTest(Test test)
{
test.Properties.Add("Version", this);
}
}
}