Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

ConstraintsExtensions.cs 1.1KB

1234567891011121314151617181920212223
  1. using NUnit.Framework.Constraints;
  2. namespace UnityEngine.TestTools.Constraints
  3. {
  4. /// <summary>
  5. /// An NUnit test constraint class to test whether a given block of code makes any GC allocations.
  6. /// </summary>
  7. public static class ConstraintExtensions
  8. {
  9. /// <summary>
  10. /// Use this with NUnit's Assert.That() method to make assertions about the GC behaviour of your code. The constraint executes the delegate you provide, and checks if it caused any GC memory to be allocated. If any GC memory was allocated, the constraint passes; otherwise, the constraint fails.
  11. /// See https://docs.unity3d.com/Packages/com.unity.test-framework@1.1/api/UnityEngine.TestTools.Constraints.AllocatingGCMemoryConstraint.html for an example.
  12. /// </summary>
  13. /// <param name="chain"></param>
  14. /// <returns></returns>
  15. public static AllocatingGCMemoryConstraint AllocatingGCMemory(this ConstraintExpression chain)
  16. {
  17. var constraint = new AllocatingGCMemoryConstraint();
  18. chain.Append(constraint);
  19. return constraint;
  20. }
  21. }
  22. }