Example #1
0
        public void Constructor()
        {
            var tree = new PointStringTree(new RectD(0, 0, 100, 100));

            tree.Add(new PointD(10, 10), "foo value");
            tree.Add(new PointD(20, 20), "bar value");
            Assert.AreEqual(2, tree.Count);

            var clone = new PointStringTree(new RectD(0, 0, 100, 100), tree);

            Assert.AreEqual(2, clone.Count);
        }
Example #2
0
        public void SetUp()
        {
            _tree = new PointStringTree(new RectD(-100, -100, 200, 200));
            Assert.AreEqual(0, _tree.Count);
            Assert.AreEqual(1, _tree.Nodes.Count);

            _tree.Add(firstKey, "first value");
            _tree.Add(secondKey, "second value");
            _tree.Add(thirdKey, "third value");
            Assert.AreEqual(3, _tree.Count);
            Assert.AreEqual(1, _tree.Nodes.Count);
        }
Example #3
0
        public void AddRange()
        {
            var tree = new PointStringTree(_tree.Bounds);

            tree.Add(new PointStringPair(fourthKey, "fourth value"));
            tree.Add(new PointStringPair(new PointD(-50, -50), "fifth value"));
            _tree.AddRange(tree);

            Assert.AreEqual(5, _tree.Count);
            Assert.IsTrue(_tree.ContainsKey(fourthKey));
            Assert.IsTrue(_tree.ContainsValue("fourth value"));
            Assert.IsTrue(_tree.ContainsKey(new PointD(-50, -50)));
            Assert.IsTrue(_tree.ContainsValue("fifth value"));

            Assert.Throws <ArgumentException>(() => _tree.AddRange(tree));
        }
Example #4
0
        public void Count()
        {
            _tree.Add(new PointD(-50, 0), "foo value");
            _tree.Add(new PointD(0, -50), "bar value");
            Assert.AreEqual(5, _tree.Count);

            _tree.Remove(new PointD(0, -50));
            Assert.AreEqual(4, _tree.Count);
        }
Example #5
0
        public void Equals()
        {
            var tree = new PointStringTree(_tree.Bounds);

            tree.Add(firstKey, "first value");
            tree.Add(secondKey, "second value");
            tree.Add(thirdKey, "third value");
            Assert.IsTrue(_tree.Equals(tree));

            tree[secondKey] = "foo value";
            Assert.IsFalse(_tree.Equals(tree));

            tree[secondKey] = "second value";
            Assert.IsTrue(_tree.Equals(tree));

            tree[fourthKey] = "second value";
            Assert.IsFalse(_tree.Equals(tree));
        }