public static void GetOrderableDynamicPartitionsWithRange(int from, int count, int desiredRangeSize)
        {
            int to          = from + count;
            var partitioner = Partitioner.Create(from, to, desiredRangeSize);

            //var elements = partitioner.GetOrderableDynamicPartitions().SelectMany(tuple => tuple.UnRoll());
            IList <int> elements = new List <int>();

            foreach (var tuple in partitioner.GetOrderableDynamicPartitions())
            {
                foreach (var item in tuple.UnRoll())
                {
                    elements.Add(item);
                }
            }
            Assert.True(elements.CompareSequences <int>(RangePartitionerHelpers.IntEnumerable(from, to)), "GetOrderableDynamicPartitions Element mismatch");

            //var keys = partitioner.GetOrderableDynamicPartitions().Select(tuple => tuple.Key).ToArray();
            IList <long> keys = new List <long>();

            foreach (var tuple in partitioner.GetOrderableDynamicPartitions())
            {
                keys.Add(tuple.Key);
            }
            Assert.True(keys.CompareSequences <long>(RangePartitionerHelpers.LongEnumerable(keys[0], keys.Count)), "GetOrderableDynamicPartitions key mismatch");

            //var rangeSizes = partitioner.GetOrderableDynamicPartitions().Select(tuple => tuple.GetRangeSize()).ToArray();
            IList <int> rangeSizes = new List <int>();

            foreach (var partition in partitioner.GetOrderableDynamicPartitions())
            {
                rangeSizes.Add(partition.GetRangeSize());
            }
            ValidateRangeSize(desiredRangeSize, rangeSizes);
        }
        public static void CheckGetOrderablePartitions(int from, int count, int dop)
        {
            int to          = from + count;
            var partitioner = Partitioner.Create(from, to);

            //var elements = partitioner.GetOrderablePartitions(dop).SelectMany(enumerator => enumerator.UnRoll());
            IList <int> elements = new List <int>();

            foreach (var partition in partitioner.GetPartitions(dop))
            {
                foreach (var item in partition.UnRoll())
                {
                    elements.Add(item);
                }
            }

            Assert.True(elements.CompareSequences <int>(RangePartitionerHelpers.IntEnumerable(from, to)), "GetOrderablePartitions Element mismatch");

            //var keys = partitioner.GetOrderablePartitions(dop).SelectMany(enumerator => enumerator.UnRollIndices()).ToArray();
            IList <long> keys = new List <long>();

            foreach (var partition in partitioner.GetOrderablePartitions(dop))
            {
                foreach (var item in partition.UnRollIndices())
                {
                    keys.Add(item);
                }
            }
            Assert.True(keys.CompareSequences <long>(RangePartitionerHelpers.LongEnumerable(keys[0], keys.Count)), "GetOrderablePartitions key mismatch");
        }
        public static void CheckGetPartitions(long from, long count, int dop)
        {
            long to          = from + count;
            var  partitioner = Partitioner.Create(from, to);

            //var elements = partitioner.GetPartitions(dop).SelectMany(enumerator => enumerator.UnRoll());
            IList <long> elements = new List <long>();

            foreach (var partition in partitioner.GetPartitions(dop))
            {
                foreach (var item in partition.UnRoll())
                {
                    elements.Add(item);
                }
            }
            Assert.True(elements.CompareSequences <long>(RangePartitionerHelpers.LongEnumerable(from, to)), "GetPartitions element mismatch");
        }
        public static void CheckGetOrderablePartitionsWithRange(long from, long count, long desiredRangeSize, int dop)
        {
            long to          = from + count;
            var  partitioner = Partitioner.Create(from, to, desiredRangeSize);

            //var elements = partitioner.GetOrderablePartitions(dop).SelectMany(enumerator => enumerator.UnRoll());
            IList <long> elements = new List <long>();

            foreach (var partition in partitioner.GetOrderablePartitions(dop))
            {
                foreach (var item in partition.UnRoll())
                {
                    elements.Add(item);
                }
            }
            Assert.True(elements.CompareSequences <long>(RangePartitionerHelpers.LongEnumerable(from, to)), "GetOrderablePartitions Element mismatch");

            //var keys = partitioner.GetOrderablePartitions(dop).SelectMany(enumerator => enumerator.UnRollIndices()).ToArray();
            IList <long> keys = new List <long>();

            foreach (var partition in partitioner.GetOrderablePartitions(dop))
            {
                foreach (var item in partition.UnRollIndices())
                {
                    keys.Add(item);
                }
            }
            Assert.True(keys.CompareSequences <long>(RangePartitionerHelpers.LongEnumerable(keys[0], keys.Count)), "GetOrderablePartitions key mismatch");

            //var rangeSizes = partitioner.GetOrderablePartitions(dop).SelectMany(enumerator => enumerator.GetRangeSize()).ToArray();
            IList <long> rangeSizes = new List <long>();

            foreach (var partition in partitioner.GetOrderablePartitions(dop))
            {
                foreach (var item in partition.GetRangeSize())
                {
                    rangeSizes.Add(item);
                }
            }

            ValidateRangeSize(desiredRangeSize, rangeSizes);
        }