/// <summary>
        /// Tests a simple node read/write operation.
        /// </summary>
        public void DoOsmDataCacheTestNode(OsmDataCache cache)
        {
            Node node = Node.Create(1, new TagsCollection(
                Tag.Create("node", "yes")), 1, 2);

            // test invalid stuff.
            Assert.Throws<ArgumentNullException>(() => cache.AddNode(null));
            Assert.Throws<Exception>(() => cache.AddNode(new Node()));
            Assert.IsNull(cache.GetNode(node.Id.Value));

            cache.AddNode(node);

            Assert.IsTrue(cache.ContainsNode(node.Id.Value));
            Node readNode = cache.GetNode(node.Id.Value);
            Assert.IsNotNull(readNode);
            Assert.AreEqual(1, readNode.Id.Value);
            Assert.AreEqual(1, readNode.Latitude.Value);
            Assert.AreEqual(2, readNode.Longitude.Value);
            Assert.IsNotNull(node.Tags);
            Assert.AreEqual(1, node.Tags.Count);
            Assert.AreEqual("yes", node.Tags["node"]);

            Assert.IsTrue(cache.TryGetNode(node.Id.Value, out readNode));
            Assert.IsNotNull(readNode);
            Assert.AreEqual(1, readNode.Id.Value);
            Assert.AreEqual(1, readNode.Latitude.Value);
            Assert.AreEqual(2, readNode.Longitude.Value);
            Assert.IsNotNull(node.Tags);
            Assert.AreEqual(1, node.Tags.Count);
            Assert.AreEqual("yes", node.Tags["node"]);

            Assert.IsTrue(cache.RemoveNode(node.Id.Value));
            Assert.IsFalse(cache.ContainsNode(node.Id.Value));
            Assert.IsFalse(cache.RemoveNode(node.Id.Value));
        }
        /// <summary>
        /// Tests the clear functionality on the datacache.
        /// </summary>
        /// <param name="cache"></param>
        public void DoOsmDataCacheTestClear(OsmDataCache cache)
        {
            Node node = Node.Create(1, new TagsCollection(
                Tag.Create("node", "yes")), 1, 2);
            Way way = Way.Create(1, new TagsCollection(
                Tag.Create("way", "yes")), 1, 2);
            Relation relation = Relation.Create(1, new TagsCollection(
                Tag.Create("relation", "yes")), RelationMember.Create(1, "something", OsmGeoType.Node));

            cache.AddNode(node);
            cache.AddWay(way);
            cache.AddRelation(relation);

            Assert.IsTrue(cache.ContainsNode(node.Id.Value));
            Assert.IsTrue(cache.ContainsWay(way.Id.Value));
            Assert.IsTrue(cache.ContainsRelation(relation.Id.Value));

            cache.Clear();

            Assert.IsFalse(cache.ContainsNode(node.Id.Value));
            Assert.IsFalse(cache.ContainsWay(way.Id.Value));
            Assert.IsFalse(cache.ContainsRelation(relation.Id.Value));
        }