PageRenderTime 20ms CodeModel.GetById 10ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/NUnit/core/Builders/CombiningStrategy.cs

#
C# | 49 lines | 36 code | 8 blank | 5 comment | 3 complexity | 6383019147452213d934ec86ad536e47 MD5 | raw file
 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
 7using System;
 8using System.Collections;
 9using System.Reflection;
10using NUnit.Core.Extensibility;
11
12namespace NUnit.Core.Builders
13{
14    public abstract class CombiningStrategy
15    {
16        protected IDataPointProvider dataPointProvider =
17            (IDataPointProvider)CoreExtensions.Host.GetExtensionPoint("DataPointProviders");
18
19        private IEnumerable[] sources;
20        private IEnumerator[] enumerators;
21
22        public CombiningStrategy(IEnumerable[] sources)
23        {
24            this.sources = sources;
25        }
26
27        public IEnumerable[] Sources
28        {
29            get { return sources; }
30        }
31
32        public IEnumerator[] Enumerators
33        {
34            get
35            {
36                if (enumerators == null)
37                {
38                    enumerators = new IEnumerator[Sources.Length];
39                    for (int i = 0; i < Sources.Length; i++)
40                        enumerators[i] = Sources[i].GetEnumerator();
41                }
42
43                return enumerators;
44            }
45        }
46
47        public abstract IEnumerable GetTestCases();
48    }
49}