public static void InsertTest()
        {
            Guid[]            anArray = { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() };
            CiccioList <Guid> col0    = new CiccioList <Guid>((IEnumerable <Guid>)anArray);
            CiccioList <Guid> col1    = new CiccioList <Guid>((IEnumerable <Guid>)anArray);
            CiccioList <Guid> col3    = new CiccioList <Guid>((IEnumerable <Guid>)anArray);

            //inserting item at the beginning.
            Guid g0 = Guid.NewGuid();

            col0.Insert(0, g0);
            Assert.Equal(g0, col0[0]);

            // inserting item in the middle
            Guid g1 = Guid.NewGuid();

            col1.Insert(1, g1);
            Assert.Equal(g1, col1[1]);

            // inserting item at the end.
            Guid g3 = Guid.NewGuid();

            col3.Insert(col3.Count, g3);
            Assert.Equal(g3, col3[col3.Count - 1]);

            string[]            anArrayString         = new string[] { "one", "two", "three", "four" };
            CiccioList <string> collection            = new CiccioList <string>((IEnumerable <string>)anArrayString);
            CollectionAndPropertyChangedTester helper = new CollectionAndPropertyChangedTester();

            helper.AddOrInsertItemTest(collection, "seven", 2);
            helper.AddOrInsertItemTest(collection, "zero", 0);
            helper.AddOrInsertItemTest(collection, "eight", collection.Count);
        }
        /// <summary>
        /// Will perform an Add or Insert on the given Collection depending on whether the
        /// insertIndex is null or not. If it is null, will Add, otherwise, will Insert.
        /// </summary>
        public void AddOrInsertItemTest(CiccioList <string> collection, string itemToAdd, int?insertIndex = null)
        {
            INotifyPropertyChanged collectionPropertyChanged = collection;

            collectionPropertyChanged.PropertyChanged += Collection_PropertyChanged;
            _expectedPropertyChanged = new[]
            {
                new PropertyNameExpected(COUNT),
                new PropertyNameExpected(ITEMARRAY)
            };

            collection.CollectionChanged += Collection_CollectionChanged;

            ExpectedCollectionChangedFired++;
            ExpectedAction   = NotifyCollectionChangedAction.Add;
            ExpectedNewItems = new string[] { itemToAdd };
            if (insertIndex.HasValue)
            {
                ExpectedNewStartingIndex = insertIndex.Value;
            }
            else
            {
                ExpectedNewStartingIndex = collection.Count;
            }
            ExpectedOldItems         = null;
            ExpectedOldStartingIndex = -1;

            int expectedCount = collection.Count + 1;

            if (insertIndex.HasValue)
            {
                collection.Insert(insertIndex.Value, itemToAdd);
                Assert.Equal(itemToAdd, collection[insertIndex.Value]);
            }
            else
            {
                collection.Add(itemToAdd);
                Assert.Equal(itemToAdd, collection[collection.Count - 1]);
            }

            Assert.Equal(expectedCount, collection.Count);
            Assert.Equal(ExpectedCollectionChangedFired, NumCollectionChangedFired);


            foreach (var item in _expectedPropertyChanged)
            {
                Assert.True(item.IsFound, "The propertychanged event should have fired for" + item.Name + ", since we just added an item");
            }

            collection.CollectionChanged -= Collection_CollectionChanged;
            collectionPropertyChanged.PropertyChanged -= Collection_PropertyChanged;
        }
        public static void InsertTest_Negative()
        {
            Guid[]            anArray    = { Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid() };
            CiccioList <Guid> collection = new CiccioList <Guid>(anArray);

            collection.CollectionChanged += (o, e) => { throw new ShouldNotBeInvokedException(); };

            Guid itemToInsert = Guid.NewGuid();

            int[] iArrInvalidValues = new int[] { -1, -2, -100, -1000, -10000, -100000, -1000000, -10000000, -100000000, -1000000000, int.MinValue };
            foreach (var index in iArrInvalidValues)
            {
                AssertExtensions.Throws <ArgumentOutOfRangeException>("index", () => collection.Insert(index, itemToInsert));
                Assert.Equal(anArray.Length, collection.Count);
            }

            int[] iArrLargeValues = new int[] { collection.Count + 1, int.MaxValue, int.MaxValue / 2, int.MaxValue / 10 };
            foreach (var index in iArrLargeValues)
            {
                AssertExtensions.Throws <ArgumentOutOfRangeException>("index", () => collection.Insert(index, itemToInsert));
                Assert.Equal(anArray.Length, collection.Count);
            }
        }