FailCommand.cs 965 B

12345678910111213141516171819202122232425262728293031323334
  1. using System.Collections;
  2. using NUnit.Framework.Interfaces;
  3. using NUnit.Framework.Internal;
  4. using NUnit.Framework.Internal.Commands;
  5. namespace UnityEngine.TestRunner.NUnitExtensions.Runner
  6. {
  7. internal class FailCommand : TestCommand, IEnumerableTestMethodCommand
  8. {
  9. private ResultState m_ResultState;
  10. private string m_Message;
  11. public FailCommand(Test test, ResultState resultState, string message)
  12. : base(test)
  13. {
  14. m_ResultState = resultState;
  15. m_Message = message;
  16. }
  17. public override TestResult Execute(ITestExecutionContext context)
  18. {
  19. context.CurrentResult.SetResult(m_ResultState, m_Message);
  20. return context.CurrentResult;
  21. }
  22. public IEnumerable ExecuteEnumerable(ITestExecutionContext context)
  23. {
  24. context.CurrentResult.SetResult(m_ResultState, m_Message);
  25. yield return null;
  26. }
  27. }
  28. }