예제 #1
0
        public void Insert_NotExistingKey_Adds(int count)
        {
            //Arrange
            var expectedTree = Enumerable.Range(0, count).ToDictionary(_ => Guid.NewGuid().ToString(), x => x);
            var radixTree    = new RadixTree <int>();

            foreach (var item in expectedTree)
            {
                // Act
                var(_, updated) = radixTree.Insert(item.Key, item.Value);

                // Assert
                Assert.False(updated);
            }

            Assert.Equal(expectedTree.Count, radixTree.Count);
            Assert.Equal(expectedTree.Keys, radixTree.Keys);
            Assert.Equal(expectedTree, radixTree.ToDictionary());
        }