/// <summary> /// Tests a simple way read/write operation. /// </summary> /// <param name="cache"></param> public void DoOsmDataCacheTestWay(OsmDataCache cache) { Way way = Way.Create(1, new TagsCollection( Tag.Create("way", "yes")), 1, 2); // test invalid stuff. Assert.Throws <ArgumentNullException>(() => cache.AddWay(null)); Assert.Throws <Exception>(() => cache.AddWay(new Way())); Assert.IsNull(cache.GetWay(way.Id.Value)); cache.AddWay(way); Assert.IsTrue(cache.ContainsWay(way.Id.Value)); Way readWay = cache.GetWay(way.Id.Value); Assert.IsNotNull(readWay); Assert.AreEqual(1, readWay.Id.Value); Assert.IsNotNull(way.Tags); Assert.AreEqual(1, way.Tags.Count); Assert.AreEqual("yes", way.Tags["way"]); Assert.IsTrue(cache.TryGetWay(way.Id.Value, out readWay)); Assert.IsNotNull(readWay); Assert.AreEqual(1, readWay.Id.Value); Assert.IsNotNull(way.Tags); Assert.AreEqual(1, way.Tags.Count); Assert.AreEqual("yes", way.Tags["way"]); Assert.IsTrue(cache.RemoveWay(way.Id.Value)); Assert.IsFalse(cache.ContainsWay(way.Id.Value)); Assert.IsFalse(cache.RemoveWay(way.Id.Value)); }