PageRenderTime 593ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/src/NUnit/core/Builders/SequentialStrategy.cs

#
C# | 55 lines | 41 code | 9 blank | 5 comment | 4 complexity | 50be939b3ad07ce7cfc25ab38cd167d7 MD5 | raw file
Possible License(s): GPL-2.0
  1. // ****************************************************************
  2. // Copyright 2008, Charlie Poole
  3. // This is free software licensed under the NUnit license. You may
  4. // obtain a copy of the license at http://nunit.org.
  5. // ****************************************************************
  6. using System;
  7. using System.Collections;
  8. #if NET_2_0
  9. using System.Collections.Generic;
  10. #endif
  11. using System.Reflection;
  12. using NUnit.Core.Extensibility;
  13. namespace NUnit.Core.Builders
  14. {
  15. public class SequentialStrategy : CombiningStrategy
  16. {
  17. public SequentialStrategy(IEnumerable[] sources) : base(sources) { }
  18. public override IEnumerable GetTestCases()
  19. {
  20. #if NET_2_0
  21. List<ParameterSet> testCases = new List<ParameterSet>();
  22. #else
  23. ArrayList testCases = new ArrayList();
  24. #endif
  25. for (; ; )
  26. {
  27. bool gotData = false;
  28. object[] testdata = new object[Sources.Length];
  29. for (int i = 0; i < Sources.Length; i++)
  30. if (Enumerators[i].MoveNext())
  31. {
  32. testdata[i] = Enumerators[i].Current;
  33. gotData = true;
  34. }
  35. else
  36. testdata[i] = null;
  37. if (!gotData)
  38. break;
  39. ParameterSet testcase = new ParameterSet();
  40. testcase.Arguments = testdata;
  41. testCases.Add(testcase);
  42. }
  43. return testCases;
  44. }
  45. }
  46. }