示例#1
0
        public void StaticPartitionerTest()
        {
            Partitioning.QueryStaticPartitioner();

            int partitionCount       = Environment.ProcessorCount * 2;
            int valueCount           = partitionCount * 10000;
            IEnumerable <int> source = Enumerable.Range(1, valueCount);
            IEnumerable <int> values = new Partitioning.StaticPartitioner <int>(source)
                                       .GetPartitions(partitionCount)
                                       .Select(partition => EnumerableEx.Create(() => partition))
                                       .Concat()
                                       .OrderBy(value => value);

            EnumerableAssert.AreSequentialEqual(source, values);
        }