BeforeAfterTestCommandState.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Data;
  3. using NUnit.Framework.Interfaces;
  4. using NUnit.Framework.Internal;
  5. namespace UnityEngine.TestTools
  6. {
  7. internal class BeforeAfterTestCommandState : ScriptableObject
  8. {
  9. public int NextBeforeStepIndex;
  10. public int NextBeforeStepPc;
  11. public int NextAfterStepIndex;
  12. public int NextAfterStepPc;
  13. public bool TestHasRun;
  14. public TestStatus CurrentTestResultStatus;
  15. public string CurrentTestResultLabel;
  16. public FailureSite CurrentTestResultSite;
  17. public string CurrentTestMessage;
  18. public string CurrentTestStrackTrace;
  19. public bool TestAfterStarted;
  20. public long Timestamp;
  21. public void Reset()
  22. {
  23. NextBeforeStepIndex = 0;
  24. NextBeforeStepPc = 0;
  25. NextAfterStepIndex = 0;
  26. NextAfterStepPc = 0;
  27. TestHasRun = false;
  28. CurrentTestResultStatus = TestStatus.Inconclusive;
  29. CurrentTestResultLabel = null;
  30. CurrentTestResultSite = default(FailureSite);
  31. CurrentTestMessage = null;
  32. CurrentTestStrackTrace = null;
  33. TestAfterStarted = false;
  34. }
  35. public void StoreTestResult(TestResult result)
  36. {
  37. CurrentTestResultStatus = result.ResultState.Status;
  38. CurrentTestResultLabel = result.ResultState.Label;
  39. CurrentTestResultSite = result.ResultState.Site;
  40. CurrentTestMessage = result.Message;
  41. CurrentTestStrackTrace = result.StackTrace;
  42. }
  43. public void ApplyTestResult(TestResult result)
  44. {
  45. result.SetResult(new ResultState(CurrentTestResultStatus, CurrentTestResultLabel, CurrentTestResultSite), CurrentTestMessage, CurrentTestStrackTrace);
  46. }
  47. }
  48. }