Example #1
0
            public void SortedEnumerable_RepeatWithDelegate_Infinitely_EnumeratesRepeatedItem()
            {
                int source = 13;
                var result = SortedEnumerableSource.Repeat(source, (x, y) => Comparer <int> .Default.Compare(y, x)).Take(3);

                Assert.IsTrue(result.SequenceEqual(new[] { 13, 13, 13 }), "Item should be repeated.");
            }
Example #2
0
            public void SortedEnumerable_Repeat_Infinitely_EnumeratesRepeatedItem()
            {
                int source = 13;
                var result = SortedEnumerableSource.Repeat(source).Take(3);

                Assert.IsTrue(result.SequenceEqual(new[] { 13, 13, 13 }), "Item should be repeated.");
            }
Example #3
0
            public void SortedEnumerable_Repeat_NegativeTimes_EnumeratesEmptySequence()
            {
                int source = 13;
                var result = SortedEnumerableSource.Repeat(source, -1);

                Assert.IsTrue(result.SequenceEqual(new int[] { }), "Item should not be repeated.");
            }
Example #4
0
            public void SortedEnumerable_RepeatWithComparer_EnumeratesRepeatedItem()
            {
                int source = 13;
                ISortedEnumerable <int> result = SortedEnumerableSource.Repeat(source, Comparer <int> .Default, 3);

                Assert.IsTrue(result.SequenceEqual(new[] { 13, 13, 13 }), "Item should be repeated.");
            }
Example #5
0
            public void SortedEnumerable_RepeatWithComparer_Infinitely_RemembersComparer()
            {
                var comparer = Comparer <int> .Default;
                int source   = 13;
                var result   = SortedEnumerableSource.Repeat(source, Comparer <int> .Default).Take(3);

                Assert.AreEqual(comparer, result.Comparer, "Comparer should be remembered.");
            }
Example #6
0
            public void SortedEnumerable_RepeatWithComparer_RemembersComparer()
            {
                var comparer = Comparer <int> .Default;
                int source   = 13;
                ISortedEnumerable <int> result = SortedEnumerableSource.Repeat(source, comparer, 3);

                Assert.AreEqual(comparer, result.Comparer, "Comparer should be remembered.");
            }