public void BulkUpdate__IndividualOperationsDoNotTriggerVersionChanged__EndingBulkUpdateTriggersVersionChanged()
        {
            var c = new CollectionEx<int>();

            var eventCalled = false;
            var lastVersion = c.Version;

            c.VersionChanged += (s, e) =>
                {
                    eventCalled = true;
                };

            using (var bulkUpdate = c.BeginBulkUpdate())
            {
                c.Add(13);
                c.AddRange(new int[] { 1, 2, 3, 4, 5 });
                c.Move(1, 0);
                c.Remove(1);
                c.RemoveAt(0);
                c.RemoveRange(0, 2);
                c.Replace(5, 6);
                c.Reset(new int[] { 11, 12, 13 });

                c[0] = 5;

                Assert.IsFalse(eventCalled);
                Assert.AreEqual(lastVersion, c.Version);
            }

            // event and version should be updated now as bulkUpdate finished

            Assert.IsTrue(eventCalled);
            Assert.AreNotEqual(lastVersion, c.Version);
        }
        public void Reset__TriggersVersionChangedEvent()
        {
            var c = new CollectionEx<int>();

            c.Add(13);

            var eventCalled = false;
            var lastVersion = c.Version;

            c.VersionChanged += (s, e) =>
            {
                if (eventCalled)
                    Assert.Fail("VersionChanged should be triggered only once during bulk updates");

                eventCalled = true;
            };

            c.Reset(new int[] { 1, 2, 3 });

            Assert.IsTrue(eventCalled);
            Assert.AreNotEqual(lastVersion, c.Version);
            Assert.AreEqual(3, c.Count);
        }