public async Task TestNode() { var map = await GetWashingtonObject(); var nodeId = map.Nodes.First().Id.Value; var node = await client.GetNode(nodeId); Assert.IsNotNull(node); var nodeVersion = client.GetNodeVersion(nodeId, 1); Assert.IsNotNull(nodeVersion); var nodeHistory = await client.GetNodeHistory(nodeId); Assert.IsTrue(nodeHistory.Any()); var multifetchNodes = await client.GetNodes(new Dictionary <long, long?>() { { nodeId, null }, { nodeId + 1, 1 } }); Assert.IsTrue(multifetchNodes.Any()); var nodeRelations = await client.GetNodeRelations(nodeId); Assert.IsNotNull(nodeRelations); var nodeWays = await client.GetNodeWays(nodeId); Assert.IsNotNull(nodeWays); }
public static async Task TestClient(INonAuthClient client) { var capabilities = await client.GetCapabilities(); var apiVersion = await client.GetVersions(); NotNull(capabilities?.Api?.Status?.Api, capabilities?.Policy, apiVersion); var map = await client.GetMap(WashingtonDC); NotNull(map?.Nodes?.FirstOrDefault(), map?.Ways?.FirstOrDefault(), map?.Relations?.FirstOrDefault()); var nodeId = map.Nodes.First().Id.Value; var wayId = map.Ways.First().Id.Value; var relationId = map.Relations.First().Id.Value; var node = await client.GetNode(nodeId); var way = await client.GetWay(wayId); var wayComplete = await client.GetCompleteWay(wayId); var relation = await client.GetRelation(relationId); var relationComplete = await client.GetCompleteRelation(relationId); var nodeVersion = await client.GetNodeVersion(nodeId, 3); NotNull(node, way, wayComplete, relation, relationComplete, nodeVersion); var nodeHistory = await client.GetNodeHistory(nodeId); var multifetchNodes = await client.GetNodes(new Dictionary <long, int?>() { { nodeId, null }, { nodeId + 1, 1 } }); var nodeRelations = await client.GetNodeRelations(nodeId); var nodeWays = await client.GetNodeWays(nodeId); True(nodeHistory?.Any(), multifetchNodes?.Any(), nodeRelations?.Any(), nodeWays?.Any()); var changeset = await client.GetChangeset(node.ChangeSetId.Value); var changesetWithDiscussion = await client.GetChangeset(node.ChangeSetId.Value, true); NotNull(changeset, changesetWithDiscussion?.Discussion); var changesets = await client.QueryChangesets(WashingtonDC, null, null, null, null, false, false, null); True(changesets?.Any()); changesets = await client.QueryChangesets(null, node.UserId, null, null, null, false, false, null); True(changesets?.Any()); changesets = await client.QueryChangesets(null, null, node.UserName, null, null, false, false, null); True(changesets?.Any()); changesets = await client.QueryChangesets(null, null, null, null, null, false, false, new long[] { 151176, 151177 }); True(changesets.Length == 2); var user = await client.GetUser(node.UserId.Value); NotNull(user); var users = await client.GetUsers(node.UserId.Value, node.UserId.Value + 1); True(users?.Any()); var gpx = await client.GetTrackPoints(TraceArea); NotNull(gpx); var notes = await client.GetNotes(NoteBounds); True(notes?.Length > 0, notes[0]?.Id.HasValue); var noteId = notes[0].Id.Value; var note = await client.GetNote(noteId); True(note?.Id == noteId); var feed = await client.GetNotesRssFeed(NoteBounds); NotNull(feed); await client.QueryNotes("ThisIsANote", null, null, null, null, null, null); await client.QueryNotes("ThisIsANote", node.UserId, null, null, null, null, null); await client.QueryNotes("ThisIsANote", null, node.UserName, null, null, null, null); await client.QueryNotes("ThisIsANote", null, null, 100, null, null, null); await client.QueryNotes("ThisIsANote", null, null, null, 1, null, null); await client.QueryNotes("ThisIsANote", null, null, null, null, DateTime.Now.Subtract(TimeSpan.FromDays(100)), null); await client.QueryNotes("ThisIsANote", null, null, null, null, null, DateTime.Now.Subtract(TimeSpan.FromDays(2))); var newNote = await client.CreateNote(10.1f, 10.2f, "HelloWorld"); True(newNote?.Comments?.Comments?.FirstOrDefault()?.Text == "HelloWorld", newNote?.Comments?.Comments?.FirstOrDefault()?.Action == Note.Comment.CommentAction.Opened, newNote?.Comments?.Comments?.FirstOrDefault()?.UserId == null, newNote?.Status == Note.NoteStatus.Open); }