1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-12 00:43:03 +00:00

Added rate limiter for api key

This commit is contained in:
Jan Korf
2019-05-01 10:15:11 +02:00
parent f880ff9f18
commit 1a9263a8a3
4 changed files with 119 additions and 1 deletions
@@ -10,6 +10,7 @@ using System.Net.Http;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using CryptoExchange.Net.Authentication;
namespace CryptoExchange.Net.UnitTests.TestImplementations
{
@@ -25,6 +26,11 @@ namespace CryptoExchange.Net.UnitTests.TestImplementations
RequestFactory = new Mock<IRequestFactory>().Object;
}
public void SetKey(string key, string secret)
{
SetAuthenticationProvider(new UnitTests.TestAuthProvider(new ApiCredentials(key, secret)));
}
public void SetResponse(string responseData, Stream requestStream = null)
{
var expectedBytes = Encoding.UTF8.GetBytes(responseData);
@@ -92,6 +98,13 @@ namespace CryptoExchange.Net.UnitTests.TestImplementations
}
}
public class TestAuthProvider : AuthenticationProvider
{
public TestAuthProvider(ApiCredentials credentials) : base(credentials)
{
}
}
public class ParseErrorTestRestClient: TestRestClient
{
public ParseErrorTestRestClient() { }