예제 #1
0
        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);
        }
예제 #2
0
        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 }));
        }
예제 #3
0
        public void ScanRightFuncIsNotInvokedOnSingleElementSequence()
        {
            const int value = 1;

            var result = new[] { value }.ScanRight(BreakingFunc.Of <int, int, int>());

            Assert.That(result, Is.EqualTo(new[] { value }));
        }
예제 #4
0
        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);
        }
예제 #5
0
        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>()));
        }
예제 #6
0
        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);
        }
예제 #7
0
        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>()));
        }
예제 #8
0
        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>()));
        }
예제 #9
0
        public void ToArrayByIndexWithBadIndexSelectorThrows()
        {
            var input = new[] { 42 };

            Assert.Throws <IndexOutOfRangeException>(() =>
                                                     input.ToArrayByIndex(_ => - 1));

            Assert.Throws <IndexOutOfRangeException>(() =>
                                                     input.ToArrayByIndex(_ => - 1, BreakingFunc.Of <int, object>()));
        }
예제 #10
0
        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));
        }
예제 #11
0
        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));
        }
예제 #12
0
        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());
        }
예제 #13
0
        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);
        }
예제 #14
0
        public void ZipShortestIsLazy()
        {
            var bs = new BreakingSequence <int>();

            bs.ZipShortest(bs, BreakingFunc.Of <int, int, int>());
        }
예제 #15
0
파일: EquiZipTest.cs 프로젝트: yln/MoreLINQ
 public void ZipWithNullFirstSequence()
 {
     MoreEnumerable.EquiZip(null, new[] { 4, 5, 6 }, BreakingFunc.Of <int, int, int>());
 }
예제 #16
0
 public void SingleOrFallbackWithLongSequence()
 {
     new[] { 10, 20, 30 }.Select(x => x).SingleOrFallback(BreakingFunc.Of <int>());
 }
예제 #17
0
 public void SingleOrFallbackWithLongSequenceIListOptimized()
 {
     new[] { 10, 20, 30 }.SingleOrFallback(BreakingFunc.Of <int>());
 }
예제 #18
0
 public void SingleOrFallbackWithSingleElementSequence()
 {
     Assert.AreEqual(10, new[] { 10 }.Select(x => x).SingleOrFallback(BreakingFunc.Of <int>()));
 }
예제 #19
0
 public void SingleOrFallbackWithSingleElementSequenceIListOptimized()
 {
     Assert.AreEqual(10, new[] { 10 }.SingleOrFallback(BreakingFunc.Of <int>()));
 }
예제 #20
0
 public void MinByIsLazy()
 {
     new BreakingSequence <int>().MinBy(BreakingFunc.Of <int, int>());
 }
예제 #21
0
 public void PartialSortByIsLazy()
 {
     new BreakingSequence <object>().PartialSortBy(1, BreakingFunc.Of <object, object>());
 }
예제 #22
0
 public void ScanRightIsLazy()
 {
     new BreakingSequence<int>().ScanRight(BreakingFunc.Of<int, int, int>());
 }
예제 #23
0
 public void SingleOrFallbackWithLongSequenceIListOptimized()
 {
     Assert.Throws <InvalidOperationException>(() =>
                                               new[] { 10, 20, 30 }.SingleOrFallback(BreakingFunc.Of <int>()));
 }
예제 #24
0
 public void ZipShortestWithNullFirstSequence()
 {
     Assert.ThrowsArgumentNullException("first", () =>
                                        MoreEnumerable.ZipShortest(null, new[] { 4, 5, 6 }, BreakingFunc.Of <int, int, int>()));
 }
예제 #25
0
 public void ScanRightSeedIsLazy()
 {
     new BreakingSequence<int>().ScanRight(string.Empty, BreakingFunc.Of<int, string, string>());
 }
예제 #26
0
 public void SingleOrFallbackWithNullSequence()
 {
     MoreEnumerable.SingleOrFallback(null, BreakingFunc.Of <int>());
 }
예제 #27
0
 public void ZipShortestWithNullSecondSequence()
 {
     Assert.ThrowsArgumentNullException("second", () =>
                                        new[] { 1, 2, 3 }.ZipShortest(null, BreakingFunc.Of <int, int, int>()));
 }
예제 #28
0
 public void FlattenPredicateIsLazy()
 {
     new BreakingSequence <int>().Flatten(BreakingFunc.Of <object, bool>());
 }
예제 #29
0
        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>()));
        }
예제 #30
0
파일: EquiZipTest.cs 프로젝트: yln/MoreLINQ
 public void ZipWithNullSecondSequence()
 {
     new[] { 1, 2, 3 }.EquiZip(null, BreakingFunc.Of <int, int, int>());
 }