Пример #1
0
        public void IndexOf_OrderIsCorrect(
            IndexOfMethod indexOfMethod,
            int count,
            bool frontToBackOrder
            )
        {
            SegmentedList <T> list = GenericListFactory(count);
            SegmentedList <T> withoutDuplicates = list.ToSegmentedList();

            list.AddRange(list);
            IndexOfDelegate IndexOf = IndexOfDelegateFromType(indexOfMethod);

            Assert.All(
                Enumerable.Range(0, count),
                i =>
            {
                if (frontToBackOrder)
                {
                    Assert.Equal(i, IndexOf(list, withoutDuplicates[i]));
                }
                else
                {
                    Assert.Equal(count + i, IndexOf(list, withoutDuplicates[i]));
                }
            }
                );
        }
        public void FindAll_VerifyDuplicates(int count)
        {
            SegmentedList <T> list = GenericListFactory(count);

            for (int i = 0; i < count / 2; i++)
            {
                list.Add(list[i]);
            }
            SegmentedList <T> beforeList = list.ToSegmentedList();
            T?            expectedItem   = default(T);
            Predicate <T> EqualsDelegate = (value) => expectedItem == null ? value == null : expectedItem.Equals(value);

            //[] Verify FindAll returns the correct List with one item
            for (int i = 0; i < count; ++i)
            {
                expectedItem = beforeList[i];
                SegmentedList <T> results = list.FindAll(EqualsDelegate);
                VerifyList(results, beforeList.Where((value) => EqualsDelegate(value)).ToSegmentedList());
            }

            //[] Verify FindAll returns an List with all of the items if the predicate always returns true
            VerifyList(list.FindAll(_alwaysTrueDelegate), beforeList);

            //[] Verify FindAll returns an empty List if the match returns false on every item
            VerifyList(list.FindAll(_alwaysFalseDelegate), new SegmentedList <T>());
        }
        public void FindLastIndex_VerifyVanilla(int count)
        {
            T?expectedItem               = default(T);
            SegmentedList <T> list       = GenericListFactory(count);
            SegmentedList <T> beforeList = list.ToSegmentedList();
            int index;
            Predicate <T> EqualsDelegate = delegate(T item) { return(expectedItem == null ? item == null : expectedItem.Equals(item)); };


            //[] Verify FinIndex returns the correct index
            for (int i = 0; i < count; ++i)
            {
                expectedItem = beforeList[i];
                index        = list.FindLastIndex(EqualsDelegate);
                Assert.Equal(i, index); //"Err_282308ahid Expected FindLastIndex to return the same."
            }

            //[] Verify FindLastIndex returns 0 if the match returns true on every item
            int expected = count == 0 ? -1 : count - 1;

            index = list.FindLastIndex(_alwaysTrueDelegate);
            Assert.Equal(expected, index); //"Err_15198ajid Verify FindLastIndex returns 0 if the match returns true on every item"

            //[] Verify FindLastIndex returns -1 if the match returns false on every item
            index = list.FindLastIndex(_alwaysFalseDelegate);
            Assert.Equal(-1, index); //"Err_305981ajodd Verify FindLastIndex returns -1 if the match returns false on every item"
        }
Пример #4
0
        public void LastIndexOf_int_OrderIsCorrectWithManyDuplicates(int count)
        {
            SegmentedList <T> list = GenericListFactory(count);
            SegmentedList <T> withoutDuplicates = list.ToSegmentedList();

            list.AddRange(list);
            list.AddRange(list);
            list.AddRange(list);

            Assert.All(
                Enumerable.Range(0, count),
                i =>
            {
                Assert.All(
                    Enumerable.Range(0, 4),
                    j =>
                {
                    int expectedIndex = (j * count) + i;
                    Assert.Equal(
                        expectedIndex,
                        list.LastIndexOf(withoutDuplicates[i], (count * (j + 1)) - 1)
                        );
                    Assert.Equal(
                        expectedIndex,
                        list.LastIndexOf(withoutDuplicates[i], (count * (j + 1)) - 1, count)
                        );
                }
                    );
            }
                );
        }
        public void FindLastIndexInt_VerifyExceptions(int count)
        {
            SegmentedList <T> list       = GenericListFactory(count);
            SegmentedList <T> beforeList = list.ToSegmentedList();
            Predicate <T>     predicate  = _alwaysTrueDelegate;


            //[] Verify Null match
            Assert.Throws <ArgumentNullException>(() => list.FindLastIndex(0, null !)); //"Err_858ahia Expected null match to throw ArgumentNullException"

            /******************************************************************************
            *  index
            ******************************************************************************/
            //[] Verify index=Int32.MinValue
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindLastIndex(int.MinValue, predicate)); //"Err_948ahid Expected index=Int32.MinValue to throw ArgumentOutOfRangeException"

            if (0 < list.Count)
            {
                //[] Verify index=-1
                Assert.Throws <ArgumentOutOfRangeException>(() => list.FindLastIndex(-1, predicate)); //"Err_328ahuaw Expected index=-1 to throw ArgumentOutOfRangeException"
            }

            //[] Verify index=list.Count + 1
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindLastIndex(list.Count + 1, predicate)); //"Err_488ajdi Expected index=list.Count + 1 to throw ArgumentOutOfRangeException"

            //[] Verify index=list.Count
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindLastIndex(list.Count, predicate)); //"Err_9689ajis Expected index=list.Count to throw ArgumentOutOfRangeException"

            //[] Verify index=Int32.MaxValue
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindLastIndex(int.MaxValue, predicate)); //"Err_238ajwisa Expected index=Int32.MaxValue to throw ArgumentOutOfRangeException"
        }
Пример #6
0
        public void Reverse_RepeatedValues(int listLength, int index, int count)
        {
            SegmentedList <T> list = GenericListFactory(1);

            for (int i = 1; i < listLength; i++)
            {
                list.Add(list[0]);
            }
            SegmentedList <T> listBefore = list.ToSegmentedList();

            list.Reverse(index, count);

            for (int i = 0; i < index; i++)
            {
                Assert.Equal(list[i], listBefore[i]); //"Expect them to be the same."
            }

            int j = 0;

            for (int i = index; i < index + count; i++)
            {
                Assert.Equal(list[i], listBefore[index + count - (j + 1)]); //"Expect them to be the same."
                j++;
            }

            for (int i = index + count; i < listBefore.Count; i++)
            {
                Assert.Equal(list[i], listBefore[i]); //"Expect them to be the same."
            }
        }
        public void FindLast_VerifyDuplicates(int count)
        {
            T?expectedItem               = default(T);
            SegmentedList <T> list       = GenericListFactory(count);
            SegmentedList <T> beforeList = list.ToSegmentedList();
            T?foundItem;
            Predicate <T?> EqualsDelegate = (T? item) => { return(expectedItem == null ? item == null : expectedItem.Equals(item)); };

            if (0 < count)
            {
                list.Add(beforeList[0]);

                //[] Verify first item is duplicated
                expectedItem = beforeList[0];
                foundItem    = list.FindLast(EqualsDelegate);
                Assert.Equal(beforeList[0], foundItem); //"Err_2879072qaiadf  Verify first item is duplicated FAILED\n"
            }

            if (1 < count)
            {
                list.Add(beforeList[1]);

                //[] Verify second item is duplicated
                expectedItem = beforeList[1];
                foundItem    = list.FindLast(EqualsDelegate);
                Assert.Equal(beforeList[1], foundItem); //"Err_4588ajdia Verify second item is duplicated FAILED\n"

                //[] Verify with match that matches more then one item
                foundItem = list.FindLast((T item) => { return(item != null && (item.Equals(beforeList[0]) || item.Equals(beforeList[1]))); });
                Assert.Equal(beforeList[1], foundItem); //"Err_4489ajodoi Verify with match that matches more then one item FAILED\n"
            }
        }
        public void Find_VerifyVanilla(int count)
        {
            SegmentedList <T?> list       = GenericListFactory(count) !;
            SegmentedList <T?> beforeList = list.ToSegmentedList();
            T?expectedItem = default(T);
            T?foundItem;
            Predicate <T?> EqualsDelegate = (T? item) => { return(expectedItem == null ? item == null : expectedItem.Equals(item)); };

            //[] Verify Find returns the correct index
            for (int i = 0; i < count; ++i)
            {
                expectedItem = beforeList[i];
                foundItem    = list.Find(EqualsDelegate);

                Assert.Equal(expectedItem, foundItem); //"Err_282308ahid Verifying value returned from Find FAILED\n"
            }

            //[] Verify Find returns the first item if the match returns true on every item
            foundItem = list.Find(_alwaysTrueDelegate);
            Assert.Equal(0 < count ? beforeList[0] : default(T), foundItem); //"Err_548ahid Verify Find returns the first item if the match returns true on every item FAILED\n"

            //[] Verify Find returns T.Default if the match returns false on every item
            foundItem = list.Find(_alwaysFalseDelegate);
            Assert.Equal(default(T), foundItem); //"Err_30848ahidi Verify Find returns T.Default if the match returns false on every item FAILED\n"

            //[] Verify with default(T)
            list.Add(default(T));
            foundItem = list.Find((T? item) => { return(item == null ? default(T) == null : item.Equals(default(T))); });
            Assert.Equal(default(T), foundItem); //"Err_541848ajodi Verify with default(T) FAILED\n"
            list.RemoveAt(list.Count - 1);
        }
        public void FindLastIndexIntInt_VerifyDuplicates(int count)
        {
            T?expectedItem               = default(T);
            SegmentedList <T> list       = GenericListFactory(count);
            SegmentedList <T> beforeList = list.ToSegmentedList();
            int           index;
            Predicate <T> EqualsDelegate = (T item) => { return(expectedItem == null ? item == null : expectedItem.Equals(item)); };

            if (0 < count)
            {
                list.Add(beforeList[0]);

                //[] Verify first item is duplicated
                expectedItem = beforeList[0];
                index        = list.FindLastIndex(list.Count - 1, list.Count, EqualsDelegate);
                Assert.Equal(list.Count - 1, index); //"Err_3282iahid Verify first item is duplicated"
            }

            if (1 < count)
            {
                list.Add(beforeList[1]);

                //[] Verify second item is duplicated
                expectedItem = beforeList[1];
                index        = list.FindLastIndex(list.Count - 1, list.Count, EqualsDelegate);
                Assert.Equal(list.Count - 1, index); //"Err_29892adewiu Verify second item is duplicated"
            }
        }
        public void AddRange_NullEnumerable_ThrowsArgumentNullException(int count)
        {
            SegmentedList <T> list          = GenericListFactory(count);
            SegmentedList <T> listBeforeAdd = list.ToSegmentedList();

            Assert.Throws <ArgumentNullException>(() => list.AddRange(null !));
            Assert.Equal(listBeforeAdd, list);
        }
        public void RemoveAll_AllElements(int count)
        {
            SegmentedList <T> list       = GenericListFactory(count);
            SegmentedList <T> beforeList = list.ToSegmentedList();
            int removedCount             = list.RemoveAll((value) => { return(true); });

            Assert.Equal(count, removedCount);
            Assert.Equal(0, list.Count);
        }
        public void RemoveAll_DefaultElements(int count)
        {
            SegmentedList <T> list                 = GenericListFactory(count);
            SegmentedList <T> beforeList           = list.ToSegmentedList();
            Predicate <T>     EqualsDefaultElement = (value) => { return(default(T) == null ? value == null : default(T) !.Equals(value)); };
            int expectedCount = beforeList.Count((value) => EqualsDefaultElement(value));
            int removedCount  = list.RemoveAll(EqualsDefaultElement);

            Assert.Equal(expectedCount, removedCount);
        }
        public void FindIndexIntInt_VerifyExceptions(int count)
        {
            SegmentedList <T> list       = GenericListFactory(count);
            SegmentedList <T> beforeList = list.ToSegmentedList();
            Predicate <T> predicate      = delegate(T item) { return(true); };


            //[] Verify Null match
            Assert.Throws <ArgumentNullException>(() => list.FindIndex(0, 0, null !)); //"Err_858ahia Expected null match to throw ArgumentNullException"

            /******************************************************************************
            *  index
            ******************************************************************************/
            //[] Verify index=Int32.MinValue
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindIndex(int.MinValue, 0, predicate)); //"Err_948ahid Expected index=Int32.MinValue to throw ArgumentOutOfRangeException"

            //[] Verify index=-1
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindIndex(-1, 0, predicate)); //"Err_328ahuaw Expected index=-1 to throw ArgumentOutOfRangeException"

            //[] Verify index=list.Count + 1
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindIndex(list.Count + 1, 0, predicate)); //"Err_488ajdi Expected index=list.Count + 1 to throw ArgumentOutOfRangeException"

            //[] Verify index=list.Count
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindIndex(list.Count, 1, predicate)); //"Err_9689ajis Expected index=list.Count to throw ArgumentOutOfRangeException"

            //[] Verify index=Int32.MaxValue
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindIndex(int.MaxValue, 0, predicate)); //"Err_238ajwisa Expected index=Int32.MaxValue to throw ArgumentOutOfRangeException"

            /******************************************************************************
            *  count
            ******************************************************************************/
            //[] Verify count=Int32.MinValue
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindIndex(0, int.MinValue, predicate)); //Err_948ahid Expected count=Int32.MinValue to throw ArgumentOutOfRangeException"

            //[] Verify count=-1
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindIndex(0, -1, predicate)); //"Err_328ahuaw Expected count=-1 to throw ArgumentOutOfRangeException"

            //[] Verify count=list.Count + 1
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindIndex(0, list.Count + 1, predicate)); //"Err_488ajdi Expected count=list.Count + 1 to throw ArgumentOutOfRangeException"

            //[] Verify count=Int32.MaxValue
            Assert.Throws <ArgumentOutOfRangeException>(() => list.FindIndex(0, int.MaxValue, predicate)); //"Err_238ajwisa Expected count=Int32.MaxValue to throw ArgumentOutOfRangeException"

            /******************************************************************************
            *  index and count
            ******************************************************************************/
            if (0 < count)
            {
                //[] Verify index=1 count=list.Length
                Assert.Throws <ArgumentOutOfRangeException>(() => list.FindIndex(1, count, predicate)); //"Err_018188avbiw Expected index=1 count=list.Length to throw ArgumentOutOfRangeException"

                //[] Verify index=0 count=list.Length + 1
                Assert.Throws <ArgumentOutOfRangeException>(() => list.FindIndex(0, count + 1, predicate)); //"Err_6848ajiodxbz Expected index=0 count=list.Length + 1 to throw ArgumentOutOfRangeException"
            }
        }
Пример #14
0
        public void IndexOf_NoDuplicates(IndexOfMethod indexOfMethod, int count, bool frontToBackOrder)
        {
            _ = frontToBackOrder;
            SegmentedList <T> list         = GenericListFactory(count);
            SegmentedList <T> expectedList = list.ToSegmentedList();
            IndexOfDelegate   IndexOf      = IndexOfDelegateFromType(indexOfMethod);

            Assert.All(Enumerable.Range(0, count), i =>
            {
                Assert.Equal(i, IndexOf(list, expectedList[i]));
            });
        }
Пример #15
0
        public void Reverse(int listLength)
        {
            SegmentedList <T> list       = GenericListFactory(listLength);
            SegmentedList <T> listBefore = list.ToSegmentedList();

            list.Reverse();

            for (int i = 0; i < listBefore.Count; i++)
            {
                Assert.Equal(list[i], listBefore[listBefore.Count - (i + 1)]); //"Expect them to be the same."
            }
        }
        public void FindIndexInt_VerifyVanilla(int count)
        {
            T?expectedItem               = default(T);
            SegmentedList <T> list       = GenericListFactory(count);
            SegmentedList <T> beforeList = list.ToSegmentedList();
            int index;
            Predicate <T> EqualsDelegate = delegate(T item) { return(expectedItem == null ? item == null : expectedItem.Equals(item)); };

            //[] Verify FinIndex returns the correct index
            for (int i = 0; i < count; ++i)
            {
                expectedItem = beforeList[i];
                index        = list.FindIndex(0, EqualsDelegate);
                Assert.Equal(i, index); //"Err_282308ahid Expected FindIndex to return the same"
            }

            //[] Verify FindIndex returns 0 if the match returns true on every item
            int expected = count == 0 ? -1 : 0;

            index = list.FindIndex(0, delegate(T item) { return(true); });
            Assert.Equal(expected, index); //"Err_15198ajid Verify FindIndex returns 0 if the match returns true on every item "

            //[] Verify FindIndex returns -1 if the match returns false on every item
            index = list.FindIndex(0, delegate(T item) { return(false); });
            Assert.Equal(-1, index); //"Err_305981ajodd Verify FindIndex returns -1 if the match returns false on every item"

            //[] Verify FindIndex returns -1 if the index == count
            index = list.FindIndex(count, delegate(T item) { return(true); });
            Assert.Equal(-1, index); //"Err_4858ajodoa Verify FindIndex returns -1 if the index == count"

            if (0 < count)
            {
                //[] Verify NEG FindIndex uses the index
                expectedItem = beforeList[0];
                index        = list.FindIndex(1, EqualsDelegate);
                Assert.Equal(-1, index); //"Err_548797ahjid Verify NEG FindIndex uses the index"
            }

            if (1 < count)
            {
                //[] Verify POS FindIndex uses the index LOWER
                expectedItem = beforeList[1];
                index        = list.FindIndex(1, EqualsDelegate);
                Assert.Equal(1, index); //"Err_68797ahid Verify POS FindIndex uses the index LOWER"

                //[] Verify POS FindIndex uses the index UPPER
                expectedItem = beforeList[count - 1];
                index        = list.FindIndex(1, EqualsDelegate);
                Assert.Equal(count - 1, index); //"Err_51488ajod Verify POS FindIndex uses the index UPPER"
            }
        }
Пример #17
0
        public void ConvertAll()
        {
            var list   = new SegmentedList <int>(new int[] { 1, 2, 3 });
            var before = list.ToSegmentedList();
            var after  = list.ConvertAll((i) => { return(10 * i); });

            Assert.Equal(before.Count, list.Count);
            Assert.Equal(before.Count, after.Count);

            for (int i = 0; i < list.Count; i++)
            {
                Assert.Equal(before[i], list[i]);
                Assert.Equal(before[i] * 10, after[i]);
            }
        }
        public void Remove_Range(int listLength, int index, int count)
        {
            SegmentedList <T> list       = GenericListFactory(listLength);
            SegmentedList <T> beforeList = list.ToSegmentedList();

            list.RemoveRange(index, count);
            Assert.Equal(list.Count, listLength - count); //"Expected them to be the same."
            for (int i = 0; i < index; i++)
            {
                Assert.Equal(list[i], beforeList[i]); //"Expected them to be the same."
            }

            for (int i = index; i < count - (index + count); i++)
            {
                Assert.Equal(list[i], beforeList[i + count]); //"Expected them to be the same."
            }
        }
        public void BinarySearch_ForEveryItemWithDuplicates(int count)
        {
            if (count > 0)
            {
                SegmentedList <T> list = GenericListFactory(count);
                list.Add(list[0]);
                list.Sort();
                SegmentedList <T> beforeList = list.ToSegmentedList();

                Assert.All(Enumerable.Range(0, list.Count), index =>
                {
                    Assert.True(list.BinarySearch(beforeList[index]) >= 0);
                    Assert.True(list.BinarySearch(beforeList[index], GetIComparer()) >= 0);
                    Assert.Equal(beforeList[index], list[index]);
                });
            }
        }
        public void FindVerifyExceptions(int count)
        {
            SegmentedList <T> list       = GenericListFactory(count);
            SegmentedList <T> beforeList = list.ToSegmentedList();

            //[] Verify Null match Find
            Assert.Throws <ArgumentNullException>(() => list.Find(null !)); //"Err_858ahia Expected null match to throw ArgumentNullException"

            //[] Verify Null match FindLast
            Assert.Throws <ArgumentNullException>(() => list.FindLast(null !)); //"Err_858ahia Expected null match to throw ArgumentNullException"

            //[] Verify Null match FindLastIndex
            Assert.Throws <ArgumentNullException>(() => list.FindLastIndex(null !)); //"Err_858ahia Expected null match to throw ArgumentNullException"

            //[] Verify Null match FindAll
            Assert.Throws <ArgumentNullException>(() => list.FindAll(null !)); //"Err_858ahia Expected null match to throw ArgumentNullException"
        }
        public void AddRange(EnumerableType enumerableType, int listLength, int enumerableLength, int numberOfMatchingElements, int numberOfDuplicateElements)
        {
            SegmentedList <T> list          = GenericListFactory(listLength);
            SegmentedList <T> listBeforeAdd = list.ToSegmentedList();
            IEnumerable <T>   enumerable    = CreateEnumerable(enumerableType, list, enumerableLength, numberOfMatchingElements, numberOfDuplicateElements);

            list.AddRange(enumerable);

            // Check that the first section of the List is unchanged
            Assert.All(Enumerable.Range(0, listLength), index =>
            {
                Assert.Equal(listBeforeAdd[index], list[index]);
            });

            // Check that the added elements are correct
            Assert.All(Enumerable.Range(0, enumerableLength), index =>
            {
                Assert.Equal(enumerable.ElementAt(index), list[index + listLength]);
            });
        }
        public void BinarySearch_ForEveryItemWithoutDuplicates(int count)
        {
            SegmentedList <T> list = GenericListFactory(count);

            foreach (T item in list)
            {
                while (list.Count((value) => value.Equals(item)) > 1)
                {
                    list.Remove(item);
                }
            }
            list.Sort();
            SegmentedList <T> beforeList = list.ToSegmentedList();

            Assert.All(Enumerable.Range(0, list.Count), index =>
            {
                Assert.Equal(index, list.BinarySearch(beforeList[index]));
                Assert.Equal(index, list.BinarySearch(beforeList[index], GetIComparer()));
                Assert.Equal(beforeList[index], list[index]);
            });
        }
        public void FindIndexIntInt_VerifyDuplicates(int count)
        {
            T?expectedItem               = default(T);
            SegmentedList <T> list       = GenericListFactory(count);
            SegmentedList <T> beforeList = list.ToSegmentedList();
            int index;
            Predicate <T> EqualsDelegate = delegate(T item) { return(expectedItem == null ? item == null : expectedItem.Equals(item)); };

            if (0 < count)
            {
                list.Add(beforeList[0]);

                //[] Verify first item is duplicated
                expectedItem = beforeList[0];
                index        = list.FindIndex(0, list.Count, EqualsDelegate);
                Assert.Equal(0, index); //"Err_3282iahid Verify first item is duplicated"

                //[] Verify first item is duplicated and index=1
                expectedItem = beforeList[0];
                index        = list.FindIndex(1, list.Count - 1, EqualsDelegate);
                Assert.Equal(count, index); //"Err_8588ahidi Verify first item is duplicated and index=1"
            }

            if (1 < count)
            {
                list.Add(beforeList[1]);

                //[] Verify second item is duplicated
                expectedItem = beforeList[1];
                index        = list.FindIndex(0, list.Count, EqualsDelegate);
                Assert.Equal(1, index); //"Err_29892adewiu Verify second item is duplicated"

                //[] Verify second item is duplicated and index=2
                expectedItem = beforeList[1];
                index        = list.FindIndex(2, list.Count - 2, EqualsDelegate);
                Assert.Equal(count + 1, index); //"Err_1580ahisdf Verify second item is duplicated and index=2"
            }
        }
        public void FindLastIndexIntInt_VerifyVanilla(int count)
        {
            T?expectedItem               = default(T);
            SegmentedList <T> list       = GenericListFactory(count);
            SegmentedList <T> beforeList = list.ToSegmentedList();
            int           index;
            Predicate <T> EqualsDelegate = (T item) => { return(expectedItem == null ? item == null : expectedItem.Equals(item)); };

            for (int i = 0; i < count; ++i)
            {
                list.Add(beforeList[i]);
            }

            //[] Verify FinIndex returns the correct index
            for (int i = 0; i < count; ++i)
            {
                expectedItem = beforeList[i];
                index        = list.FindLastIndex(count - 1, count, EqualsDelegate);
                Assert.Equal(i, index); //"Err_282308ahid Expected FindLastIndex to be the same."
            }

            //[] Verify FindLastIndex returns 0 if the match returns true on every item
            int expected = count == 0 ? -1 : count - 1;

            index = list.FindLastIndex(count - 1, count, _alwaysTrueDelegate);
            Assert.Equal(expected, index); //"Err_15198ajid Verify FindLastIndex returns 0 if the match returns true on every item"

            //[] Verify FindLastIndex returns -1 if the match returns false on every item
            index = list.FindLastIndex(count - 1, count, _alwaysFalseDelegate);
            Assert.Equal(-1, index); //"Err_305981ajodd Verify FindLastIndex returns -1 if the match returns false on every item"

            if (0 < count)
            {
                //[] Verify FindLastIndex returns -1 if the index == 0
                index = list.FindLastIndex(0, 0, _alwaysTrueDelegate);
                Assert.Equal(-1, index); //"Err_298298ahdi Verify FindLastIndex returns -1 if the index=0"

                //[] Verify NEG FindLastIndex uses the count
                expectedItem = beforeList[0];
                index        = list.FindLastIndex(count - 1, count - 1, EqualsDelegate);
                Assert.Equal(-1, index); //"Err_7894ahoid Verify NEG FindLastIndex uses the count"
            }

            if (1 < count)
            {
                //[] Verify NEG FindLastIndex uses the index
                expectedItem = beforeList[count - 1];
                index        = list.FindLastIndex(count - 2, count - 1, EqualsDelegate);
                Assert.Equal(-1, index); //"Err_548797ahjid Verify NEG FindLastIndex uses the index"

                //[] Verify POS FindLastIndex uses the index
                expectedItem = beforeList[count - 2];
                index        = list.FindLastIndex(count - 2, count - 1, EqualsDelegate);
                Assert.Equal(count - 2, index); //"Err_68797ahid Verify POS FindLastIndex uses the index"

                //[] Verify POS FindLastIndex uses the count
                expectedItem = beforeList[count - 2];
                index        = list.FindLastIndex(count - 1, count - 1, EqualsDelegate);
                Assert.Equal(count - 2, index); //"Err_28278ahdii Verify POS FindLastIndex uses the count"

                //[] Verify NEG FindLastIndex uses the index and count LOWER
                expectedItem = beforeList[0];
                index        = list.FindLastIndex(count - 2, count - 2, EqualsDelegate);
                Assert.Equal(-1, index); //"Err_384984ahjiod Verify NEG FindLastIndex uses the index and count LOWER"

                //[] Verify NEG FindLastIndex uses the index and count UPPER
                expectedItem = beforeList[count - 1];
                index        = list.FindLastIndex(count - 2, count - 2, EqualsDelegate);
                Assert.Equal(-1, index); //"Err_1489haidid Verify NEG FindLastIndex uses the index and count UPPER"

                //[] Verify POS FindLastIndex uses the index and count LOWER
                expectedItem = beforeList[1];
                index        = list.FindLastIndex(count - 2, count - 2, EqualsDelegate);
                Assert.Equal(1, index); //"Err_604890ahjid Verify POS FindLastIndex uses the index and count LOWER"

                //[] Verify POS FindLastIndex uses the index and count UPPER
                expectedItem = beforeList[count - 2];
                index        = list.FindLastIndex(count - 2, count - 2, EqualsDelegate);
                Assert.Equal(count - 2, index); //"Err_66844ahidd Verify POS FindLastIndex uses the index and count UPPER"
            }
        }