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)); }
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)); }
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(); }
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(); }