public void RightJoinWithHomogeneousSequencesIsLazy() { var xs = new BreakingSequence <int>(); var ys = new BreakingSequence <int>(); Assert.DoesNotThrow(() => xs.RightJoin(ys, e => e, BreakingFunc.Of <int, object>(), BreakingFunc.Of <int, int, object>())); }
public void RightJoinIsLazy() { var xs = new BreakingSequence <int>(); var ys = new BreakingSequence <object>(); Assert.DoesNotThrow(() => xs.RightJoin(ys, x => x.GetHashCode(), y => y, BreakingFunc.Of <object, object>(), BreakingFunc.Of <int, object, object>())); }
public void ToArrayByIndexWithBadIndexSelectorThrows() { var input = new[] { 42 }; Assert.Throws <IndexOutOfRangeException>(() => input.ToArrayByIndex(_ => - 1)); Assert.Throws <IndexOutOfRangeException>(() => input.ToArrayByIndex(_ => - 1, BreakingFunc.Of <int, object>())); }
public void LeftJoinWithHomogeneousSequencesWithComparerIsLazy() { var xs = new BreakingSequence <int>(); var ys = new BreakingSequence <int>(); Assert.DoesNotThrow(() => xs.LeftJoin(ys, e => e, BreakingFunc.Of <int, object>(), BreakingFunc.Of <int, int, object>(), comparer: null)); }
public void TestSegmentationStartsWithSecondItem() { var sequence = new[] { 0 }; var resultA = sequence.Segment(BreakingFunc.Of <int, bool>()); var resultB = sequence.Segment(BreakingFunc.Of <int, int, bool>()); var resultC = sequence.Segment(BreakingFunc.Of <int, int, int, bool>()); Assert.IsTrue(resultA.Any()); Assert.IsTrue(resultB.Any()); Assert.IsTrue(resultC.Any()); }
public void LeftJoinWithComparerIsLazy() { var xs = new BreakingSequence <int>(); var ys = new BreakingSequence <object>(); Assert.DoesNotThrow(() => xs.LeftJoin(ys, x => x, y => y.GetHashCode(), BreakingFunc.Of <int, object>(), BreakingFunc.Of <int, object, object>(), comparer: null)); }
public void GroupAdjacentIsLazy() { var bs = new BreakingSequence <object>(); var bf = BreakingFunc.Of <object, int>(); var bfo = BreakingFunc.Of <object, object>(); var bfg = BreakingFunc.Of <int, IEnumerable <object>, IEnumerable <object> >(); bs.GroupAdjacent(bf); bs.GroupAdjacent(bf, bfo); bs.GroupAdjacent(bf, bfo, EqualityComparer <int> .Default); bs.GroupAdjacent(bf, EqualityComparer <int> .Default); bs.GroupAdjacent(bf, bfg); bs.GroupAdjacent(bf, bfg, EqualityComparer <int> .Default); }
public void SingleOrFallbackWithSingleElementSequence() { Assert.AreEqual(10, new[] { 10 }.Select(x => x).SingleOrFallback(BreakingFunc.Of <int>())); }
public void SingleOrFallbackWithSingleElementSequenceIListOptimized() { Assert.AreEqual(10, new[] { 10 }.SingleOrFallback(BreakingFunc.Of <int>())); }
public void ZipWithNullFirstSequence() { MoreEnumerable.EquiZip(null, new[] { 4, 5, 6 }, BreakingFunc.Of <int, int, int>()); }
public void SingleOrFallbackWithNullSequence() { MoreEnumerable.SingleOrFallback(null, BreakingFunc.Of <int>()); }
public void IsLazy() { new BreakingSequence <object>() .CountDown(42, BreakingFunc.Of <object, int?, object>()); }
public void ZipWithNullSecondSequence() { new[] { 1, 2, 3 }.EquiZip(null, BreakingFunc.Of <int, int, int>()); }
public void ZipShortestIsLazy() { var bs = new BreakingSequence <int>(); bs.ZipShortest(bs, BreakingFunc.Of <int, int, int>()); }
public void TestSegmentIsLazy() { new BreakingSequence <int>().Segment(BreakingFunc.Of <int, bool>()); new BreakingSequence <int>().Segment(BreakingFunc.Of <int, int, bool>()); new BreakingSequence <int>().Segment(BreakingFunc.Of <int, int, int, bool>()); }
public void MinByIsLazy() { new BreakingSequence <int>().MinBy(BreakingFunc.Of <int, int>()); }
public void PartialSortByIsLazy() { new BreakingSequence <object>().PartialSortBy(1, BreakingFunc.Of <object, object>()); }
public void TestLeadIsLazy() { new BreakingSequence <int>().Lead(5, BreakingFunc.Of <int, int, int>()); new BreakingSequence <int>().Lead(5, -1, BreakingFunc.Of <int, int, int>()); }
public void FlattenPredicateIsLazy() { new BreakingSequence <int>().Flatten(BreakingFunc.Of <object, bool>()); }
public void TagFirstLastIsLazy() { new BreakingSequence <object>().TagFirstLast(BreakingFunc.Of <object, bool, bool, object>()); }
public void SingleOrFallbackWithLongSequence() { new[] { 10, 20, 30 }.Select(x => x).SingleOrFallback(BreakingFunc.Of <int>()); }
public void ScanRightSeedIsLazy() { new BreakingSequence<int>().ScanRight(string.Empty, BreakingFunc.Of<int, string, string>()); }
public void SingleOrFallbackWithLongSequenceIListOptimized() { new[] { 10, 20, 30 }.SingleOrFallback(BreakingFunc.Of <int>()); }
public void ZipIsLazy() { var bs = new BreakingSequence <int>(); bs.EquiZip(bs, BreakingFunc.Of <int, int, int>()); }
public void ScanRightIsLazy() { new BreakingSequence<int>().ScanRight(BreakingFunc.Of<int, int, int>()); }
public void FoldWithTooManyItems() { Assert.Throws <InvalidOperationException>(() => Enumerable.Range(1, 3).Fold(BreakingFunc.Of <int, int, int>())); }
public void SingleOrFallbackWithLongSequenceIListOptimized() { Assert.Throws <InvalidOperationException>(() => new[] { 10, 20, 30 }.SingleOrFallback(BreakingFunc.Of <int>())); }
public void ZipShortestWithNullSecondSequence() { Assert.ThrowsArgumentNullException("second", () => new[] { 1, 2, 3 }.ZipShortest(null, BreakingFunc.Of <int, int, int>())); }
public void ToArrayByIndexWithLengthWithBadIndexSelectorThrows(int length, int badIndex) { var input = new[] { 42 }; Assert.Throws <IndexOutOfRangeException>(() => input.ToArrayByIndex(length, _ => badIndex)); Assert.Throws <IndexOutOfRangeException>(() => input.ToArrayByIndex(10, _ => - 1, BreakingFunc.Of <int, object>())); }
public void ZipShortestWithNullFirstSequence() { Assert.ThrowsArgumentNullException("first", () => MoreEnumerable.ZipShortest(null, new[] { 4, 5, 6 }, BreakingFunc.Of <int, int, int>())); }