/// <summary>
        /// Initializes a new CombinatorialEngine from the specified
        /// dimensions.
        /// </summary>
        /// <param name='dimensions'>Dimensions to use in engine.</param>
        /// <returns>A new CombinatorialEngine instance.</returns>
        private CombinatorialEngine(Dimension[] dimensions)
        {
            if (dimensions == null)
            {
                throw new ArgumentNullException("dimensions");
            }
            if (dimensions.Length == 0)
            {
                throw new ArgumentException("Dimensions cannot be empty.");
            }
            if (Array.IndexOf(dimensions, null) != -1)
            {
                throw new ArgumentException("Dimensions cannot have null elements.");
            }

            SetupForDimensions(dimensions);
        }
 /// <summary>
 /// Sets up the engine to use the specified dimensions in a
 /// combinatorial run.
 /// </summary>
 private void SetupForDimensions(Dimension[] dimensions)
 {
     System.Diagnostics.Debug.Assert(dimensions != null);
     
     this.dimensions = dimensions;
     valueIndexes = new int[dimensions.Length];
     beforeStart = true;
 }