public void FullGroupIsLazy() { var listA = new BreakingSequence <int>(); var listB = new BreakingSequence <int>(); listA.FullGroupJoin(listB, x => x, x => x, BreakingFunc.Of <int, IEnumerable <int>, IEnumerable <int>, int>()); Assert.True(true); }
public void ScanRightSeedFuncIsNotInvokedOnEmptySequence() { const int value = 1; var result = new int[0].ScanRight(value, BreakingFunc.Of <int, int, int>()); Assert.That(result, Is.EqualTo(new[] { value })); }
public void ScanRightFuncIsNotInvokedOnSingleElementSequence() { const int value = 1; var result = new[] { value }.ScanRight(BreakingFunc.Of <int, int, int>()); Assert.That(result, Is.EqualTo(new[] { value })); }
public void FullGroupIsLazy() { var bs = new BreakingSequence <int>(); var bf = BreakingFunc.Of <int, int>(); var bfg = BreakingFunc.Of <int, IEnumerable <int>, IEnumerable <int>, int>(); bs.FullGroupJoin(bs, bf, bf, bfg); }
public void AssertCountNegativeCount() { var source = new object[0]; AssertThrowsArgument.OutOfRangeException("count", () => source.AssertCount(-1)); AssertThrowsArgument.OutOfRangeException("count", () => source.AssertCount(-1, BreakingFunc.Of <int, int, Exception>())); }
public void TestFromIsLazy() { var breakingFunc = BreakingFunc.Of <int>(); MoreEnumerable.From(breakingFunc); MoreEnumerable.From(breakingFunc, breakingFunc); MoreEnumerable.From(breakingFunc, breakingFunc, breakingFunc); MoreEnumerable.From(breakingFunc, breakingFunc, breakingFunc, breakingFunc); }
public void LeftJoinIsLazy() { 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>())); }
public void LeftJoinWithHomogeneousSequencesIsLazy() { 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>())); }
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 RightJoinWithHomogeneousSequencesWithComparerIsLazy() { 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>(), comparer: null)); }
public void RightJoinWithComparerIsLazy() { 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>(), 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 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 ZipShortestIsLazy() { var bs = new BreakingSequence <int>(); bs.ZipShortest(bs, BreakingFunc.Of <int, int, int>()); }
public void ZipWithNullFirstSequence() { MoreEnumerable.EquiZip(null, new[] { 4, 5, 6 }, BreakingFunc.Of <int, int, int>()); }
public void SingleOrFallbackWithLongSequence() { new[] { 10, 20, 30 }.Select(x => x).SingleOrFallback(BreakingFunc.Of <int>()); }
public void SingleOrFallbackWithLongSequenceIListOptimized() { new[] { 10, 20, 30 }.SingleOrFallback(BreakingFunc.Of <int>()); }
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 MinByIsLazy() { new BreakingSequence <int>().MinBy(BreakingFunc.Of <int, int>()); }
public void PartialSortByIsLazy() { new BreakingSequence <object>().PartialSortBy(1, BreakingFunc.Of <object, object>()); }
public void ScanRightIsLazy() { new BreakingSequence<int>().ScanRight(BreakingFunc.Of<int, int, int>()); }
public void SingleOrFallbackWithLongSequenceIListOptimized() { Assert.Throws <InvalidOperationException>(() => new[] { 10, 20, 30 }.SingleOrFallback(BreakingFunc.Of <int>())); }
public void ZipShortestWithNullFirstSequence() { Assert.ThrowsArgumentNullException("first", () => MoreEnumerable.ZipShortest(null, new[] { 4, 5, 6 }, BreakingFunc.Of <int, int, int>())); }
public void ScanRightSeedIsLazy() { new BreakingSequence<int>().ScanRight(string.Empty, BreakingFunc.Of<int, string, string>()); }
public void SingleOrFallbackWithNullSequence() { MoreEnumerable.SingleOrFallback(null, BreakingFunc.Of <int>()); }
public void ZipShortestWithNullSecondSequence() { Assert.ThrowsArgumentNullException("second", () => new[] { 1, 2, 3 }.ZipShortest(null, BreakingFunc.Of <int, int, int>())); }
public void FlattenPredicateIsLazy() { new BreakingSequence <int>().Flatten(BreakingFunc.Of <object, bool>()); }
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 ZipWithNullSecondSequence() { new[] { 1, 2, 3 }.EquiZip(null, BreakingFunc.Of <int, int, int>()); }