Ejemplo n.º 1
0
        public void TestToImmutable()
        {
            int value = Generator.GetInt32();

            ImmutableSortedTreeList <int> .Builder list = ImmutableSortedTreeList.CreateBuilder <int>();
            Assert.Empty(list);
            Assert.Same(ImmutableSortedTreeList <int> .Empty, list.ToImmutable());

            list.Add(value);
            Assert.Equal(new[] { value }, list.ToImmutable());
            Assert.Same(list.ToImmutable(), list.ToImmutable());

            list.Add(value);
            Assert.Equal(new[] { value, value }, list.ToImmutable());
            Assert.Same(list.ToImmutable(), list.ToImmutable());
        }