コード例 #1
0
        public void ImmutableLinkedList_ThreadSafeAddRange()
        {
            var list = ImmutableLinkedList <int> .Empty;

            ImmutableLinkedList.ThreadSafeAddRange(ref list, new[] { 5, 10, 15 });

            Assert.Equal(3, list.Count);
            Assert.Contains(5, list);
            Assert.Contains(10, list);
            Assert.Contains(15, list);
        }
コード例 #2
0
        public void ImmutableLinkedList_Null_Reference_Check()
        {
            var value = (ImmutableLinkedList <int>)null;

            Assert.Throws <ArgumentNullException>(() => ImmutableLinkedList.ThreadSafeAddRange(ref value, new [] { 5 }));

            value = ImmutableLinkedList <int> .Empty;

            Assert.Throws <ArgumentNullException>(() => ImmutableLinkedList.ThreadSafeAddRange(ref value, null));

            Assert.Throws <ArgumentNullException>(() => ImmutableLinkedList <int> .Empty.Visit(null));

            Assert.Throws <ArgumentNullException>(() => ImmutableLinkedList <int> .Empty.AddRange(null));

            Assert.Throws <ArgumentNullException>(() => ImmutableLinkedList.From <int>(null));
        }