Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ test-results*/
.idea/*

packages/*
!packages/repositories.config
!packages/repositories.config
.vs
TestResults
2 changes: 1 addition & 1 deletion OsmSharp.IO.API.Tests/NonAuthTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void TestToStringCulture()
const string doubleString = "-77.06719208";

var cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
var clientAsChild = client as NonAuthClient;
var clientAsChild = client as OsmClient;

foreach (var culture in cultures)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using OsmSharp.API;
using OsmSharp.Changesets;
using OsmSharp.Tags;
using System;
using System.IO;
using System.Linq;
using System.Net.Http;
Expand All @@ -12,8 +11,7 @@
namespace OsmSharp.IO.API.Tests
{
[TestClass]
[Ignore("Should only be ran manually - comment-out for testing, do not check-in")]
public class BasicAuthClientTests
public class OAuth2ClientTests
{
private IAuthClient client;

Expand All @@ -26,7 +24,7 @@ public class BasicAuthClientTests

private static readonly TagsCollection ChangeSetTags = new TagsCollection()
{
new Tag("comment", "Running a functional test of an automated system."),
new Tag("comment", "Running a functional test of an automation tool."),
new Tag("created_by", "https://github.com/OsmSharp/osm-api-client/"),
new Tag("bot", "yes")
};
Expand All @@ -37,13 +35,12 @@ public void TestInitialize()
using var loggerFactory = LoggerFactory.Create(b => b.AddConsole());
var logger = loggerFactory.CreateLogger("Tests");
IClientsFactory clientFactory = new ClientsFactory(logger, new HttpClient(), ClientsFactory.DEVELOPMENT_URL);
// Enter your user name and password here or OAuth credential below - do not check-in!
client = clientFactory.CreateBasicAuthClient("user-email", "password");
//client = clientFactory.CreateOAuthClient("customerkey", "customerSecret", "token", "tokenSecret");
//client = clientFactory.CreateOAuth2Client("token");
// Enter your OAuth2 credential below - do not check-in!
client = clientFactory.CreateOAuth2Client("oAuth-token");
}

[TestMethod]
[Ignore("Should only be ran manually - comment-out for testing, do not check-in")]
public async Task TestChangesetLifeCycle()
{
var user = await client.GetUserDetails();
Expand Down Expand Up @@ -101,6 +98,7 @@ public async Task TestChangesetLifeCycle()
}

[TestMethod]
[Ignore("Should only be ran manually - comment-out for testing, do not check-in")]
public async Task TestPreferences()
{
var preferences = await client.GetUserPreferences();
Expand All @@ -122,6 +120,7 @@ public async Task TestPreferences()
}

[TestMethod]
[Ignore("Should only be ran manually - comment-out for testing, do not check-in")]
public async Task TestNotes()
{
var permissions = await client.GetPermissions();
Expand Down Expand Up @@ -162,6 +161,7 @@ public async Task TestNotes()
}

[TestMethod]
[Ignore("Should only be ran manually - comment-out for testing, do not check-in")]
public async Task TestTraces()
{
using var gpxStream = File.Open("test.gpx", FileMode.Open);
Expand All @@ -171,6 +171,7 @@ public async Task TestTraces()
NewGpx.Description += updatedText;
await client.UpdateTrace(NewGpx);
var myTraces = await client.GetTraces();
var originalLength = myTraces.Length;
Assert.IsTrue(myTraces?.Length > 0);
var gpxDetails = await client.GetTraceDetails(NewGpx.Id);
Assert.IsNotNull(gpxDetails);
Expand All @@ -179,12 +180,9 @@ public async Task TestTraces()
Assert.IsNotNull(gpxStreamBack.Stream);
Assert.IsNotNull(gpxStreamBack.FileName);
Assert.IsNotNull(gpxStreamBack.ContentType);
foreach (var trace in myTraces)
{
await client.DeleteTrace(trace.Id);
}
await client.DeleteTrace(NewGpx.Id);
myTraces = await client.GetTraces();
Assert.AreEqual(0 ,myTraces?.Length);
Assert.AreEqual(originalLength - 1, myTraces?.Length);
}
}
}
2 changes: 1 addition & 1 deletion OsmSharp.IO.API.Tests/OsmSharp.IO.API.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Loading
Loading