Example #1
0
        public void Can_concat_arrays()
        {
            var tree = HashTreeX <int, string[]> .Using(ConcatArrays)
                       .AddOrUpdate(0, new[] { "a" })
                       .AddOrUpdate(0, new[] { "b" })
                       .AddOrUpdate(0, new[] { "c" });

            Assert.That(tree.TryGet(0), Is.EqualTo(new[] { "a", "b", "c" }));
        }
Example #2
0
        public void Can_combine_arrays_into_one_AND_get_it_by_key()
        {
            var tree = HashTreeX <int, string[]> .Using(ConcatArrays);

            var list = new List <string[]>(100);

            for (var i = 0; i < 100; i++)
            {
                tree = tree.AddOrUpdate(i, new[] { i.ToString() });
                list.Add(new[] { i.ToString() });
            }

            Assert.That(tree.Select(kv => kv.Value), Is.EqualTo(list));
        }