public static void LongPartitionerThreadSafety()
        {
            ConcurrentBag <OrderablePartitioner <Tuple <long, long> > > bag = new ConcurrentBag <OrderablePartitioner <Tuple <long, long> > >();

            Parallel.Invoke(
                () => bag.Add(Partitioner.Create((long)0, (long)1000)),
                () => bag.Add(Partitioner.Create((long)1000, (long)2000)),
                () => bag.Add(Partitioner.Create((long)2000, (long)3000)),
                () => bag.Add(Partitioner.Create((long)3000, (long)4000)),
                () => bag.Add(Partitioner.Create((long)4000, (long)5000)),
                () => bag.Add(Partitioner.Create((long)5000, (long)6000)),
                () => bag.Add(Partitioner.Create((long)6000, (long)7000)),
                () => bag.Add(Partitioner.Create((long)7000, (long)8000)),
                () => bag.Add(Partitioner.Create((long)8000, (long)9000))
                );

            foreach (var partitioner in bag)
            {
                // Test one of the GetPartitions* method to make sure that partitioner is in a good state
                //var elements = partitioner.GetDynamicPartitions().SelectMany(tuple => tuple.UnRoll()).ToArray();
                IList <long> elements = new List <long>();
                foreach (var tuple in partitioner.GetDynamicPartitions())
                {
                    foreach (var item in tuple.UnRoll())
                    {
                        elements.Add(item);
                    }
                }
                long from = elements[0];
                elements.CompareSequences <long>(RangePartitionerHelpers.LongEnumerable(from, from + 1000));
            }
        }
        public static void IntPartitionerThreadSafety()
        {
            ConcurrentBag <OrderablePartitioner <Tuple <int, int> > > bag = new ConcurrentBag <OrderablePartitioner <Tuple <int, int> > >();

            Parallel.Invoke(
                () => bag.Add(Partitioner.Create(0, 1000)),
                () => bag.Add(Partitioner.Create(1000, 2000)),
                () => bag.Add(Partitioner.Create(2000, 3000)),
                () => bag.Add(Partitioner.Create(3000, 4000)),
                () => bag.Add(Partitioner.Create(4000, 5000)),
                () => bag.Add(Partitioner.Create(5000, 6000)),
                () => bag.Add(Partitioner.Create(6000, 7000)),
                () => bag.Add(Partitioner.Create(7000, 8000)),
                () => bag.Add(Partitioner.Create(8000, 9000))
                );

            foreach (var partitioner in bag)
            {
                // Test one of the GetPartitions* method to make sure that partitioner is in a good state
                //var elements = partitioner.GetDynamicPartitions().SelectMany(tuple => tuple.UnRoll()).ToArray();
                IList <int> elements = new List <int>();
                foreach (var tuple in partitioner.GetDynamicPartitions())
                {
                    foreach (var item in tuple.UnRoll())
                    {
                        elements.Add(item);
                    }
                }
                int from = elements[0];
                elements.CompareSequences <int>(RangePartitionerHelpers.IntEnumerable(from, from + 1000));
                from = from + 1000;
            }
        }