1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-08 00:16:27 +00:00

56 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using CryptoExchange.Net.Authentication;
using CryptoExchange.Net.Interfaces;
namespace CryptoExchange.Net.UnitTests
{
public class TestImplementation: ExchangeClient
{
public TestImplementation(): base(new ExchangeOptions(), null) { }
public TestImplementation(ExchangeOptions exchangeOptions) : base(exchangeOptions, exchangeOptions.ApiCredentials == null ? null : new TestAuthProvider(exchangeOptions.ApiCredentials))
{
}
public void SetApiCredentails(string key, string secret)
{
SetAuthenticationProvider(new TestAuthProvider(new ApiCredentials(key, secret)));
}
public CallResult<TestObject> TestCall()
{
return ExecuteRequest<TestObject>(new Uri("http://www.test.com")).Result;
}
}
public class TestAuthProvider : AuthenticationProvider
{
public TestAuthProvider(ApiCredentials credentials) : base(credentials)
{
}
public override string AddAuthenticationToUriString(string uri, bool signed)
{
return uri;
}
public override IRequest AddAuthenticationToRequest(IRequest request, bool signed)
{
return request;
}
public override string Sign(string toSign)
{
return toSign;
}
}
public class TestObject
{
public int Id { get; set; }
public List<string> Data { get; set; }
}
}