TestResultAdaptor.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using UnityEditor.TestTools.TestRunner.Api;
  3. namespace Microsoft.Unity.VisualStudio.Editor.Testing
  4. {
  5. [Serializable]
  6. internal class TestResultAdaptorContainer
  7. {
  8. public TestResultAdaptor[] TestResultAdaptors;
  9. }
  10. [Serializable]
  11. internal class TestResultAdaptor
  12. {
  13. public string Name;
  14. public string FullName;
  15. public int PassCount;
  16. public int FailCount;
  17. public int InconclusiveCount;
  18. public int SkipCount;
  19. public string ResultState;
  20. public string StackTrace;
  21. public TestStatusAdaptor TestStatus;
  22. public int Parent;
  23. public TestResultAdaptor(ITestResultAdaptor testResultAdaptor, int parent)
  24. {
  25. Name = testResultAdaptor.Name;
  26. FullName = testResultAdaptor.FullName;
  27. PassCount = testResultAdaptor.PassCount;
  28. FailCount = testResultAdaptor.FailCount;
  29. InconclusiveCount = testResultAdaptor.InconclusiveCount;
  30. SkipCount = testResultAdaptor.SkipCount;
  31. switch (testResultAdaptor.TestStatus)
  32. {
  33. case UnityEditor.TestTools.TestRunner.Api.TestStatus.Passed:
  34. TestStatus = TestStatusAdaptor.Passed;
  35. break;
  36. case UnityEditor.TestTools.TestRunner.Api.TestStatus.Skipped:
  37. TestStatus = TestStatusAdaptor.Skipped;
  38. break;
  39. case UnityEditor.TestTools.TestRunner.Api.TestStatus.Inconclusive:
  40. TestStatus = TestStatusAdaptor.Inconclusive;
  41. break;
  42. case UnityEditor.TestTools.TestRunner.Api.TestStatus.Failed:
  43. TestStatus = TestStatusAdaptor.Failed;
  44. break;
  45. }
  46. Parent = parent;
  47. }
  48. }
  49. }