/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
- // ****************************************************************
- // Copyright 2008, Charlie Poole
- // This is free software licensed under the NUnit license. You may
- // obtain a copy of the license at http://nunit.org.
- // ****************************************************************
-
- using System;
- using System.Collections;
- #if NET_2_0
- using System.Collections.Generic;
- #endif
- using System.Reflection;
- using NUnit.Core.Extensibility;
-
- namespace NUnit.Core.Builders
- {
- public class SequentialStrategy : CombiningStrategy
- {
- public SequentialStrategy(IEnumerable[] sources) : base(sources) { }
-
- public override IEnumerable GetTestCases()
- {
- #if NET_2_0
- List<ParameterSet> testCases = new List<ParameterSet>();
- #else
- ArrayList testCases = new ArrayList();
- #endif
-
- for (; ; )
- {
- bool gotData = false;
- object[] testdata = new object[Sources.Length];
-
- for (int i = 0; i < Sources.Length; i++)
- if (Enumerators[i].MoveNext())
- {
- testdata[i] = Enumerators[i].Current;
- gotData = true;
- }
- else
- testdata[i] = null;
-
- if (!gotData)
- break;
-
- ParameterSet testcase = new ParameterSet();
- testcase.Arguments = testdata;
-
- testCases.Add(testcase);
- }
-
- return testCases;
- }
- }
- }