-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMarketHttpClientsTests.cs
80 lines (57 loc) · 2.39 KB
/
MarketHttpClientsTests.cs
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
75
76
77
78
79
80
using TradingBot.Core.Domain;
using TradingBot.HttpClients.ByBit;
using TradingBot.HttpClients.ByBit.RequestModels;
namespace TradingBot.HttpClients.Tests.ByBit
{
public class MarketHttpClientsTests
{
private readonly MarketHttpClient _httpClient;
public MarketHttpClientsTests(MarketHttpClient httpClient)
{
_httpClient = httpClient;
}
[Fact]
public async Task GetKlineAsync_WithModel_ReturnNotNullAndEmptyResponse()
{
var model = new GetKlineRequestModel(Category.Spot, "ETHUSDT", Interval.FiveMinutes,
DateTime.UtcNow.AddDays(-1), DateTime.UtcNow);
var response = await _httpClient.GetKlineAsync(model);
Assert.NotNull(response);
Assert.NotNull(response.Result);
Assert.NotNull(response.Result.Values);
Assert.NotEmpty(response.Result.Values);
}
[Fact]
public async Task GetInstrumentsInfoAsync_WithModel_ReturnNotNullAndEmptyResponse()
{
var model = new GetInstrumentsInfoRequestModel(Category.Spot);
var response = await _httpClient.GetInstrumentsInfoAsync(model);
Assert.NotNull(response);
Assert.NotNull(response.Result);
Assert.NotNull(response.Result.Instruments);
Assert.NotEmpty(response.Result.Instruments);
}
[Fact]
public async Task GetOrderbookAsync_WithModel_ReturnNotNullAndEmptyResponse()
{
var model = new GetOrderbookRequestModel(Category.Spot, "ETHUSDT");
var response = await _httpClient.GetOrderbookAsync(model);
Assert.NotNull(response);
Assert.NotNull(response.Result);
Assert.NotNull(response.Result.Buyers);
Assert.NotNull(response.Result.Sellers);
Assert.NotEmpty(response.Result.Buyers);
Assert.NotEmpty(response.Result.Sellers);
}
[Fact]
public async Task GetTickersAsync_WithModel_ReturnNotNullAndEmptyResponse()
{
var model = new GetTickersRequestModel(Category.Spot);
var response = await _httpClient.GetTickersAsync(model);
Assert.NotNull(response);
Assert.NotNull(response.Result);
Assert.NotNull(response.Result.Tickers);
Assert.NotEmpty(response.Result.Tickers);
}
}
}