/// <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));
        }
        /// <summary>
        /// Tests a simple relation read/write operation.
        /// </summary>
        /// <param name="cache"></param>
        public void DoOsmDataCacheTestRelation(OsmDataCache cache)
        {
            Relation relation = Relation.Create(1, new TagsCollection(
                Tag.Create("relation", "yes")), RelationMember.Create(1, "something", OsmGeoType.Node));

            // test invalid stuff.
            Assert.Throws<ArgumentNullException>(() => cache.AddRelation(null));
            Assert.Throws<Exception>(() => cache.AddRelation(new Relation()));
            Assert.IsNull(cache.GetRelation(relation.Id.Value));

            cache.AddRelation(relation);

            Assert.IsTrue(cache.ContainsRelation(relation.Id.Value));
            Relation readRelation = cache.GetRelation(relation.Id.Value);
            Assert.IsNotNull(readRelation);
            Assert.AreEqual(1, readRelation.Id.Value);
            Assert.IsNotNull(relation.Tags);
            Assert.AreEqual(1, relation.Tags.Count);
            Assert.AreEqual("yes", relation.Tags["relation"]);

            Assert.IsTrue(cache.TryGetRelation(relation.Id.Value, out readRelation));
            Assert.IsNotNull(readRelation);
            Assert.AreEqual(1, readRelation.Id.Value);
            Assert.IsNotNull(relation.Tags);
            Assert.AreEqual(1, relation.Tags.Count);
            Assert.AreEqual("yes", relation.Tags["relation"]);

            Assert.IsTrue(cache.RemoveRelation(relation.Id.Value));
            Assert.IsFalse(cache.ContainsRelation(relation.Id.Value));
            Assert.IsFalse(cache.RemoveRelation(relation.Id.Value));
        }