No Description
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.

EnumerableApplyChangesToContextCommand.cs 1.1KB

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using NUnit.Framework.Interfaces;
  5. using NUnit.Framework.Internal;
  6. using NUnit.Framework.Internal.Commands;
  7. using UnityEngine.TestRunner.NUnitExtensions.Runner;
  8. namespace UnityEngine.TestTools
  9. {
  10. internal class EnumerableApplyChangesToContextCommand : ApplyChangesToContextCommand, IEnumerableTestMethodCommand
  11. {
  12. public EnumerableApplyChangesToContextCommand(TestCommand innerCommand, IEnumerable<IApplyToContext> changes)
  13. : base(innerCommand, changes) {}
  14. public IEnumerable ExecuteEnumerable(ITestExecutionContext context)
  15. {
  16. ApplyChanges(context);
  17. if (innerCommand is IEnumerableTestMethodCommand)
  18. {
  19. var executeEnumerable = ((IEnumerableTestMethodCommand)innerCommand).ExecuteEnumerable(context);
  20. foreach (var iterator in executeEnumerable)
  21. {
  22. yield return iterator;
  23. }
  24. }
  25. else
  26. {
  27. context.CurrentResult = innerCommand.Execute(context);
  28. }
  29. }
  30. }
  31. }