public void PartitionBy_WithNonEmptyEnumerableAndLesserCount_ExpectsEnumerableWithMultipleSlices()
        {
            var slices = ENMRBL_NON_EMPTY.PartitionBy(COUNT_LESSER);

            Equal(Math.Ceiling((double)COUNT_RIGHT / COUNT_LESSER), slices.Count());
            Equal(ENMRBL_NON_EMPTY, slices.SelectMany(s => s), MultiItemsEnumerableEqualityComparer.Instance);
        }
 public void PartitionIf_WithNonEmptyEnumerableAndAnyIndex_ExpectsEnumerablesOfSameTotalLength()
 => Utilities.AssertManySequencesEqual(
     ENMRBL_NON_EMPTY.PartitionIf((index, item) => index < COUNT_ANY),
     new[] {
     ENMRBL_NON_EMPTY.Take(COUNT_ANY),
     ENMRBL_NON_EMPTY.Skip(COUNT_ANY),
 });
        public void GetFNVHashCode_WithNonEmptyEnumerable_ExpectsAllUniqueHashCodes()
        {
            var result = ENMRBL_NON_EMPTY
                         .Select(item => new[] { item }.GetFNVHashCode())
                         .ToList();

            Equal(result, result.Distinct());
        }
 public void TryGetSingle_WithNonEmptyEnumerableAndTautologicalLambda_ExpectsRightItem()
 {
     foreach (var itemPredicate in ENMRBL_NON_EMPTY)
     {
         True(ENMRBL_NON_EMPTY.TryGetSingle(item => item.ID == itemPredicate.ID, out var rightItem));
         Equal(ENMRBL_NON_EMPTY.SingleOrDefault(item => item.ID == itemPredicate.ID), rightItem);
     }
 }
        public void GroupToDictionary_WithNonEmptyEnumerableAndIdentifyFunction_ExpectsDictionaryOfSingles()
        {
            var dictionary = ENMRBL_NON_EMPTY.GroupToDictionary(DefaultDelegates.IdentityFunction <MultiItems>());

            Equal(ENMRBL_NON_EMPTY.ToList(), dictionary.Keys);
            Utilities.AssertManySequencesEqual(
                ENMRBL_NON_EMPTY.Select(item => new[] { item }),
                dictionary.Values);
        }
        public void Cycle_WithNonEmptyEnumerableAndNullRepeat_ExpectsInfiniteEnumerable()
        {
            var cycle = ENMRBL_NON_EMPTY.Cycle();

            using (var enmrtr = cycle.GetEnumerator())
            {
                for (var index = 0; enmrtr.MoveNext(); ++index)
                {
                    if (index == COUNT_BIG)
                    {
                        break;
                    }
                }
                True(enmrtr.MoveNext());
            }
        }
 public void PartitionBy_WithNonEmptyEnumerableAndEmptyCount_Throws()
 => Throws <ArgumentOutOfRangeException>(
     () => ENMRBL_NON_EMPTY.PartitionBy(0).ToList());
 public void GroupToDictionary_WithNullKeySelector_Throws()
 => Throws <ArgumentNullException>(
     () => ENMRBL_NON_EMPTY.GroupToDictionary <MultiItems, MultiItems>(null));
 public void TryGetLast_WithNonEmptyEnumerableAndTautologicalLambda_ExpectsLastItem()
 {
     True(ENMRBL_NON_EMPTY.TryGetLast(DefaultDelegates.TautologicalLambda <MultiItems>(), out var lastItem));
     Equal(ENMRBL_NON_EMPTY.LastOrDefault(), lastItem);
 }
 public void TryGetSingle_WithNullPredicate_Throws()
 => Throws <ArgumentNullException>(
     () => ENMRBL_NON_EMPTY.TryGetSingle(null, out _));
 public void HasCount_WithNonEmptyEnumerableAndGreaterCount_ExpectsFalse()
 => False(ENMRBL_NON_EMPTY.HasCount(COUNT_GREATER));
 public void PartitionIf_WithNonEmptyEnumerableAndAlwaysOtherPartition_ExpectsEnumerableOfEmpties()
 => Utilities.AssertManySequencesEqual(
     ENMRBL_NON_EMPTY.PartitionIf(AlwaysOtherPartition).Take(COUNT_BIG),
     Enumerable.Range(0, COUNT_BIG).Select(item => new MultiItems[0]));
 public void HasCount_WithNonEmptyEnumerableAndEmptyCount_ExpectsFalse()
 => False(ENMRBL_NON_EMPTY.HasCount(0));
 public void PartitionBy_WithNonEmptyEnumerableAndGreaterCount_ExpectsSameEnumerableAsSingleEnumerable()
 => Utilities.AssertManySequencesEqual(
     ENMRBL_NON_EMPTY.PartitionBy(COUNT_GREATER),
     Enumerable.Repeat(ENMRBL_NON_EMPTY, 1));
 public void GroupToDictionary_WithNullValueSelector_Throws()
 => Throws <ArgumentNullException>(
     () => ENMRBL_NON_EMPTY.GroupToDictionary <MultiItems, MultiItems, MultiItems>(
         DefaultDelegates.IdentityFunction <MultiItems>(), null));
 public void Cycle_WithNonEmptyEnumerableAndNoRepeat_ExpectsEmptyEnumerable()
 => Utilities.AssertManySequencesEqual(
     ENMRBL_NON_EMPTY.Cycle(0),
     ENMRBL_EMPTY);
 public void Flatten_WithNonEmptyEnumerableAndBreadthMode_ExpectsRightEnumerable()
 => Utilities.AssertManySequencesEqual(
     ENMRBL_NON_EMPTY.Flatten(TreeTraversalMode.Breadth),
     ENMRBL_FLAT_BREADTH);
 public void Cycle_WithNonEmptyEnumerableAndAnyRepeat_ExpectsSameEnumerableTimesAny()
 => Utilities.AssertManySequencesEqual(
     ENMRBL_NON_EMPTY.Cycle(COUNT_ANY),
     Enumerable.Repeat(ENMRBL_NON_EMPTY, COUNT_ANY)
     .SelectMany(coll => coll));
 public void ToShuffled_WithNonEmptyEnumerable_ExpectsOtherEnumerable()
 => Utilities.AssertManySequencesEquivalent(
     ENMRBL_NON_EMPTY.ToShuffled(),
     ENMRBL_NON_EMPTY);
 public void HasCount_WithNonEmptyEnumerableAndNegativeCount_Throws()
 => Throws <ArgumentOutOfRangeException>(
     () => ENMRBL_NON_EMPTY.HasCount(-COUNT_ANY));
 public void ToShuffled_WithNonEmptyEnumerableSorted_ExpectsSameEnumerable()
 => Utilities.AssertManySequencesEqual(
     ENMRBL_NON_EMPTY.ToShuffled().OrderBy(x => x.ID),
     ENMRBL_NON_EMPTY);
 public void HasCount_WithNonEmptyEnumerableAndRightCount_ExpectsTrue()
 => True(ENMRBL_NON_EMPTY.HasCount(COUNT_RIGHT));
 public void GetRandom_WithNonEmptyEnumerableAndIndexedRandomSource_ExpectsSameItems()
 => True(ENMRBL_NON_EMPTY.SequenceEqual(
             Enumerable.Range(0, COUNT_RIGHT)
             .Select(index => ENMRBL_NON_EMPTY.GetRandom(x => index))));
 public void HasCount_WithNonEmptyEnumerableAndLesserCount_ExpectsFalse()
 => False(ENMRBL_NON_EMPTY.HasCount(COUNT_LESSER));
 public void PartitionIf_WithNonEmptyEnumerableAndAlwaysSamePartition_ExpectsSameEnumerableAsSingleEnumerable()
 => Utilities.AssertManySequencesEqual(
     ENMRBL_NON_EMPTY.PartitionIf(AlwaysSamePartition),
     Enumerable.Repeat(ENMRBL_NON_EMPTY, 1));