[Test] public void InsertRangeInsertCollectionIntoEmptyList()
        {
            var sut = new CopyOnWriteList <T>();

            sut.InsertRange(0, Samples);
            CollectionAssert.AreEqual(Samples, sut);
        }
        public void InsertRangeInsertsCollectionInRightPosition(Position position)
        {
            var index      = PositionToIndex(position);
            var samples    = Samples;
            var sampleSize = SampleSize;
            var sut        = new CopyOnWriteList <T>(samples);
            var c          = new[]
            {
                TestData <T> .M1,
                TestData <T> .M2,
                TestData <T> .M3,
            };

            sut.InsertRange(index, c);
            for (int i = 0; i < index; i++)
            {
                Assert.That(sut[i], Is.EqualTo(samples[i]));
            }
            var addCount = c.Length;

            for (int i = 0; i < addCount; i++)
            {
                Assert.That(sut[index + i], Is.EqualTo(c[i]));
            }
            for (int i = index + addCount; i < sampleSize; i++)
            {
                Assert.That(sut[i + addCount], Is.EqualTo(samples[i]));
            }
        }
        [Test] public void InsertRangeChokesOnNullCollection()
        {
            var sut = new CopyOnWriteList <T>(Samples);
            var e   = Assert.Catch <ArgumentNullException>(() => sut.InsertRange(0, null));

            Assert.That(e.ParamName, Is.EqualTo("collection"));
        }
        public void InsertRangeChokesOnBadIndex(Position position)
        {
            var index = PositionToIndex(position);
            var sut   = new CopyOnWriteList <T>(Samples);
            var e     = Assert.Catch <ArgumentOutOfRangeException>(() => sut.InsertRange(index, Samples));

            Assert.That(e.ParamName, Is.EqualTo("index"));
        }