public void APITestRelationCreateGetUpdate() { // intialize the connection. var apiInstance = new APIConnection("http://api06.dev.openstreetmap.org/", "osmsharp", "osmsharp"); // open a changeset. apiInstance.ChangeSetOpen("Simple Relation Creation Test"); // initialize the relation. var relation = new Relation(); relation.Tags = new SimpleTagsCollection(); relation.Tags.Add("type", "testrelation"); relation.Members = new List <RelationMember>(); relation.Visible = true; // initialize the nodes. var node = new Node(); node.Latitude = -0.494497; node.Longitude = -24.119325; node.Tags = new SimpleTagsCollection(); node.Tags.Add("type", "testnode1"); node.Visible = true; node = apiInstance.NodeCreate(node); relation.Members.Add(new RelationMember() { MemberId = node.Id.Value, MemberRole = "some_nodes_role", MemberType = OsmGeoType.Node }); node = new Node(); node.Latitude = -0.494497 + 0.0001f; node.Longitude = -24.119325 + 0.0001f; node.Tags = new SimpleTagsCollection(); node.Tags.Add("type", "testnode2"); node.Visible = true; node = apiInstance.NodeCreate(node); relation.Members.Add(new RelationMember() { MemberId = node.Id.Value, MemberRole = "some_nodes_role", MemberType = OsmGeoType.Node }); // save the relation. relation = apiInstance.RelationCreate(relation); // close the changeset. apiInstance.ChangeSetClose(); // check if the id now has a value. Assert.IsTrue(relation.Id.HasValue); // get the new relation id. long relationId = relation.Id.Value; // open new changeset. apiInstance.ChangeSetOpen("Simple Relation Update Test"); // get the relation. Relation apiRelation = apiInstance.RelationGet(relation.Id.Value); apiRelation.Tags.Add("another_tag", "test adding a tag!"); apiInstance.RelationUpdate(apiRelation); // close the current changeset. apiInstance.ChangeSetClose(); // get the api relation. apiRelation = apiInstance.RelationGet(relation.Id.Value); Assert.AreEqual(2, apiRelation.Tags.Count); Assert.IsTrue(apiRelation.Tags.ContainsKey("another_tag")); Assert.AreEqual("test adding a tag!", apiRelation.Tags["another_tag"]); }