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

            Assert.Equal(element, query.Single());
            Assert.Equal(element, query.Single(x => true));
        }
Beispiel #2
0
        public static void Single_Empty(Labeled <ParallelQuery <int> > labeled, int count, int element)
        {
            ParallelQuery <int> query = labeled.Item;

            Assert.Throws <InvalidOperationException>(() => query.Single());
            Assert.Throws <InvalidOperationException>(() => query.Single(x => true));
        }
Beispiel #3
0
        public static void Single_NoMatch(Labeled <ParallelQuery <int> > labeled, int count, int element)
        {
            ParallelQuery <int> query = labeled.Item;
            IntegerRangeSet     seen  = new IntegerRangeSet(0, count);

            Assert.Throws <InvalidOperationException>(() => query.Single(x => !seen.Add(x)));
            seen.AssertComplete();
        }
Beispiel #4
0
        public static void Single_OneMatch(Labeled <ParallelQuery <int> > labeled, int count, int element)
        {
            ParallelQuery <int> query = labeled.Item;
            IntegerRangeSet     seen  = new IntegerRangeSet(0, count);

            Assert.Equal(element, query.Single(x => seen.Add(x) && x == element));
            seen.AssertComplete();
        }