forked from linguanostra/GoogleMapsAPI.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPITests.cs
More file actions
74 lines (57 loc) · 2.5 KB
/
Copy pathAPITests.cs
File metadata and controls
74 lines (57 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using GoogleMapsAPI.NET.API.Client;
using GoogleMapsAPI.NET.API.Client.Interfaces;
using GoogleMapsAPI.NET.Tests.Config;
using Rhino.Mocks;
namespace GoogleMapsAPI.NET.Tests.API.Common
{
/// <summary>
/// API tests
/// </summary>
public class APITests
{
#region Methods
/// <summary>
/// Get API client (with API key)
/// </summary>
/// <param name="apiKey">API key</param>
/// <param name="clientConfig">Client config</param>
/// <returns>Client</returns>
public IMapsAPIClient GetAPIClient(string apiKey = TestsStaticConfiguration.GoogleMapsAPIKey, MapsAPIClientConfig clientConfig = null)
{
return new MapsAPIClient(apiKey, clientConfig??MapsAPIClientConfig.Default());
}
/// <summary>
/// Get mocked API client (with API key)
/// </summary>
/// <param name="apiKey">API key</param>
/// <param name="clientConfig">Client config</param>
/// <returns>Client</returns>
public IMapsAPIClient GetMockedAPIClient(string apiKey = TestsStaticConfiguration.GoogleMapsAPIKey, MapsAPIClientConfig clientConfig = null)
{
return MockRepository.GenerateMock<MapsAPIClient>(apiKey, clientConfig??MapsAPIClientConfig.Default());
}
/// <summary>
/// Get API client (with enteprrise credentials)
/// </summary>
/// <param name="clientId">Client Id</param>
/// <param name="clientSecret">Client secret</param>
/// <param name="clientConfig">Client config</param>
/// <returns>Client</returns>
public IMapsAPIClient GetAPIClient(string clientId, string clientSecret, MapsAPIClientConfig clientConfig = null)
{
return new MapsAPIClient(clientId, clientSecret, clientConfig??MapsAPIClientConfig.Default());
}
/// <summary>
/// Get mocked API client (with enteprrise credentials)
/// </summary>
/// <param name="clientId">Client Id</param>
/// <param name="clientSecret">Client secret</param>
/// <param name="clientConfig">Client config</param>
/// <returns>Client</returns>
public IMapsAPIClient GetMockedAPIClient(string clientId, string clientSecret, MapsAPIClientConfig clientConfig = null)
{
return MockRepository.GenerateMock<MapsAPIClient>(clientId, clientSecret, clientConfig ?? MapsAPIClientConfig.Default());
}
#endregion
}
}