示例#1
0
            public void GlobalSetup()
            {
                this.filter = new ParallelFilter(10, 100);
                var random = new Random();

                this.data = Enumerable.Range(1, 1000000).OrderBy(_ => random.Next()).ToArray();
            }
示例#2
0
        public void ParallelFilterPerformanceTest()
        {
            var sw = new Stopwatch();

            var filter = new ParallelFilter(10, 100);
            var random = new Random();
            var data   = Enumerable.Range(1, 1000000).OrderBy(_ => random.Next()).ToArray();

            sw.Start();

            filter.Search(data, d => d % 2 == 0);

            sw.Stop();

            Assert.GreaterOrEqual(TimeSpan.FromSeconds(1), sw.Elapsed);
        }