Esempio n. 1
0
        public void RemoveIfEmpty()
        {
            using var list = new PoolingListRef <object>();

            Assert.AreEqual(0, list.Count);
            Assert.AreEqual(false, list.Remove(29));
        }
Esempio n. 2
0
        public void SingleAdditionAndRemove()
        {
            using var list = new PoolingListRef <object>();
            list.Add(30);
            list.Remove(30);

            Assert.AreEqual(0, list.Count);
            Assert.Throws <IndexOutOfRangeException>(() => { var _ = list[0]; });
        }
Esempio n. 3
0
        public void MakeListFromValueTupleAndGoBack()
        {
            using var list = new PoolingListRef <object>();

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

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

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