Skip to content

Commit 9ba87bd

Browse files
committed
Provide interfaces #1 - Seems like there's a need to use the interfaces in the factory as well to allow testing.
1 parent 8951c6f commit 9ba87bd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

FunctionalTests/Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static class Tests
4949
Visibility = Visibility.Public,
5050
};
5151

52-
public static async Task TestClient(NonAuthClient client)
52+
public static async Task TestClient(INonAuthClient client)
5353
{
5454
var capabilities = await client.GetCapabilities();
5555
var apiVersion = await client.GetVersions();
@@ -110,7 +110,7 @@ public static async Task TestClient(NonAuthClient client)
110110
newNote?.Status == Note.NoteStatus.Open);
111111
}
112112

113-
public static async Task TestAuthClient(AuthClient client)
113+
public static async Task TestAuthClient(IAuthClient client)
114114
{
115115
var permissions = await client.GetPermissions();
116116
True(permissions?.UserPermission?.Any());

src/ClientsFactory.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ public ClientsFactory(ILogger logger, HttpClient httpClient, string baseAddress)
2121
}
2222

2323
/// <inheritdoc/>
24-
public NonAuthClient CreateNonAuthClient()
24+
public INonAuthClient CreateNonAuthClient()
2525
{
2626
return new NonAuthClient(_baseAddress, _httpClient, _logger);
2727
}
2828

2929
/// <inheritdoc/>
30-
public AuthClient CreateBasicAuthClient(string username, string password)
30+
public IAuthClient CreateBasicAuthClient(string username, string password)
3131
{
3232
return new BasicAuthClient(_httpClient, _logger, _baseAddress, username, password);
3333
}
3434

3535
/// <inheritdoc/>
36-
public AuthClient CreateOAuthClient(string consumerKey, string consumerSecret, string token, string tokenSecret)
36+
public IAuthClient CreateOAuthClient(string consumerKey, string consumerSecret, string token, string tokenSecret)
3737
{
3838
return new OAuthClient(_httpClient, _logger, _baseAddress, consumerKey, consumerSecret, token, tokenSecret);
3939
}

src/IClientsFactory.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ public interface IClientsFactory
1010
/// Creates a client that does not need authentication and thus can't perform authenticated operations
1111
/// </summary>
1212
/// <returns></returns>
13-
NonAuthClient CreateNonAuthClient();
13+
INonAuthClient CreateNonAuthClient();
1414
/// <summary>
1515
/// Creates a client that needs user name and password credentials
1616
/// </summary>
1717
/// <param name="username"></param>
1818
/// <param name="password"></param>
1919
/// <returns></returns>
20-
AuthClient CreateBasicAuthClient(string username, string password);
20+
IAuthClient CreateBasicAuthClient(string username, string password);
2121
/// <summary>
2222
/// Creates a client that will use OAuth 1.0 credentials provided from the OAuth OSM page
2323
/// </summary>
@@ -26,6 +26,6 @@ public interface IClientsFactory
2626
/// <param name="token"></param>
2727
/// <param name="tokenSecret"></param>
2828
/// <returns></returns>
29-
AuthClient CreateOAuthClient(string consumerKey, string consumerSecret, string token, string tokenSecret);
29+
IAuthClient CreateOAuthClient(string consumerKey, string consumerSecret, string token, string tokenSecret);
3030
}
3131
}

0 commit comments

Comments
 (0)