コード例 #1
0
        public void MakeListFromValueTupleClearAndFillBack()
        {
            using var list = new PoolingListCanon <object>();

            list.Add(10);
            list.Add(20);
            list.Add(30);

            list.Clear();

            Assert.AreEqual(0, list.Count);
            Assert.Throws <IndexOutOfRangeException>(() => { var _ = list[0]; });

            list.Add(10);
            list.Add(20);
            list.Add(30);

            Assert.AreEqual(3, list.Count);
            Assert.AreEqual(10, list[0]);
            Assert.AreEqual(20, list[1]);
            Assert.AreEqual(30, list[2]);

            Assert.Throws <IndexOutOfRangeException>(() => { var _ = list[3]; });
        }