暫無描述
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.

ImmediateEnumerableCommand.cs 1.0KB

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using NUnit.Framework.Internal;
  3. using NUnit.Framework.Internal.Commands;
  4. using UnityEngine.TestRunner.NUnitExtensions.Runner;
  5. namespace UnityEngine.TestTools
  6. {
  7. internal class ImmediateEnumerableCommand : DelegatingTestCommand
  8. {
  9. public ImmediateEnumerableCommand(TestCommand innerCommand)
  10. : base(innerCommand) {}
  11. public override TestResult Execute(ITestExecutionContext context)
  12. {
  13. if (innerCommand is IEnumerableTestMethodCommand)
  14. {
  15. var executeEnumerable = ((IEnumerableTestMethodCommand)innerCommand).ExecuteEnumerable(context);
  16. foreach (var iterator in executeEnumerable)
  17. {
  18. if (iterator != null)
  19. {
  20. throw new Exception("Only null can be yielded at this point.");
  21. }
  22. }
  23. return context.CurrentResult;
  24. }
  25. return innerCommand.Execute(context);
  26. }
  27. }
  28. }