WorkItemFactory.cs 875 B

12345678910111213141516171819202122232425262728
  1. using System.Collections;
  2. using NUnit.Framework.Interfaces;
  3. using NUnit.Framework.Internal;
  4. namespace UnityEngine.TestRunner.NUnitExtensions.Runner
  5. {
  6. internal abstract class WorkItemFactory
  7. {
  8. public UnityWorkItem Create(ITest loadedTest, ITestFilter filter)
  9. {
  10. TestSuite suite = loadedTest as TestSuite;
  11. if (suite != null)
  12. {
  13. return new CompositeWorkItem(suite, filter, this);
  14. }
  15. var testMethod = (TestMethod)loadedTest;
  16. if (testMethod.Method.ReturnType.Type != typeof(IEnumerator))
  17. {
  18. return new DefaultTestWorkItem(testMethod, filter);
  19. }
  20. return Create(testMethod, filter, loadedTest);
  21. }
  22. protected abstract UnityWorkItem Create(TestMethod method, ITestFilter filter, ITest loadedTest);
  23. }
  24. }