暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VersionAttribute.cs 1.0KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using NUnit.Framework;
  3. using NUnit.Framework.Interfaces;
  4. using NUnit.Framework.Internal;
  5. namespace Unity.PerformanceTesting
  6. {
  7. /// <summary>
  8. /// Test attribute to specify test version.
  9. /// </summary>
  10. [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
  11. public class VersionAttribute : NUnitAttribute, IApplyToTest
  12. {
  13. /// <summary>
  14. /// Test version.
  15. /// </summary>
  16. public string Version { get; }
  17. /// <summary>
  18. /// Adds attribute to specify test version.
  19. /// </summary>
  20. /// <param name="version">Version of the test.</param>
  21. public VersionAttribute(string version)
  22. {
  23. Version = version;
  24. }
  25. /// <summary>
  26. /// Used by NUnit to apply version to properties.
  27. /// </summary>
  28. /// <param name="test">An NUnit test to apply the version property to.</param>
  29. public void ApplyToTest(Test test)
  30. {
  31. test.Properties.Add("Version", this);
  32. }
  33. }
  34. }