public void ValidateCreateFullyParallel()
 {
     using (ParallelOptionsScope scope = ParallelOptionsScope.CreateFullyParallel())
     {
         Assert.IsNotNull(scope);
         Assert.AreEqual(Environment.ProcessorCount, ParallelOptionsScope.Current.MaxDegreeOfParallelism);
         Assert.IsTrue(ParallelOptionsScope.Exists);
     }
     ApplicationLog.WriteLine(string.Concat(
                                  "ParallelOptionsScope BVT: Validation of CreateFullyParallel method completed successfully."));
 }
예제 #2
0
        public void TestParallelQueryExtensionsWithParallelOptionsScope()
        {
            List <ClusterStatus> clusterStatusList = HpcLibSettings.ActiveClusters.Where(name => !name.Equals("msr-gcb-n10", StringComparison.CurrentCultureIgnoreCase))
                                                     .Select(clusterName => new ClusterStatus(clusterName)).ToList();

            List <ClusterStatus> expected = clusterStatusList;

            using (ParallelOptionsScope.CreateFullyParallel())
            {
                clusterStatusList.AsParallel().WithParallelOptionsScope();
            }

            Assert.AreSame(expected, clusterStatusList);
        }