Example #1
0
        public static void SingleOrDefault(Labeled <ParallelQuery <int> > labeled, int count, int element)
        {
            ParallelQuery <int> query = labeled.Item;

            Assert.Equal(count >= 1 ? element : default(int), query.SingleOrDefault());
            Assert.Equal(count >= 1 ? element : default(int), query.SingleOrDefault(x => true));
        }
Example #2
0
        public static void SingleOrDefault_NoMatch(Labeled <ParallelQuery <int> > labeled, int count, int element)
        {
            ParallelQuery <int> query = labeled.Item;
            IntegerRangeSet     seen  = new IntegerRangeSet(0, count);

            Assert.Equal(default(int), query.SingleOrDefault(x => !seen.Add(x)));
            seen.AssertComplete();
        }
Example #3
0
        public static void SingleOrDefault_AllMatch(Labeled <ParallelQuery <int> > labeled, int count, int element)
        {
            ParallelQuery <int> query = labeled.Item;

            Assert.Throws <InvalidOperationException>(() => query.SingleOrDefault(x => true));
        }