public void APITestWayCreateGetUpdate() { // intialize the connection. var apiInstance = new APIConnection("http://api06.dev.openstreetmap.org/", "osmsharp", "osmsharp"); // open a changeset. apiInstance.ChangeSetOpen("Simple Way Creation Test"); // initialize the way. var way = new Way(); way.Tags = new TagsCollection(); way.Tags.Add("type", "testway"); way.Nodes = new List<long>(); way.Visible = true; // initialize the nodes. var node = new Node(); node.Latitude = -0.494497; node.Longitude = -24.119325; node.Tags = new TagsCollection(); node.Tags.Add("type", "testnode1"); node.Visible = true; node = apiInstance.NodeCreate(node); way.Nodes.Add(node.Id.Value); node = new Node(); node.Latitude = -0.494497 + 0.0001f; node.Longitude = -24.119325 + 0.0001f; node.Tags = new TagsCollection(); node.Tags.Add("type", "testnode2"); node.Visible = true; node = apiInstance.NodeCreate(node); way.Nodes.Add(node.Id.Value); // save the way. way = apiInstance.WayCreate(way); // close the changeset. apiInstance.ChangeSetClose(); // check if the id now has a value. Assert.IsTrue(way.Id.HasValue); // get the new way id. long wayId = way.Id.Value; // open new changeset. apiInstance.ChangeSetOpen("Simple Way Update Test"); // get the way. Way apiWay = apiInstance.WayGet(way.Id.Value); apiWay.Tags.Add("another_tag", "test adding a tag!"); apiInstance.WayUpdate(apiWay); // close the current changeset. apiInstance.ChangeSetClose(); // get the api way. apiWay = apiInstance.WayGet(way.Id.Value); Assert.AreEqual(2, apiWay.Tags.Count); Assert.IsTrue(apiWay.Tags.ContainsKey("another_tag")); Assert.AreEqual("test adding a tag!", apiWay.Tags["another_tag"]); }