-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathReportsTest.cs
56 lines (45 loc) · 1.39 KB
/
ReportsTest.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
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Coinbase.Pro.Models;
using FluentAssertions;
using NUnit.Framework;
using VerifyNUnit;
namespace Coinbase.Tests.EndpointTests
{
public class ReportsTest : TestWithAuth
{
[Test]
public async Task create_report()
{
server.RespondWithJsonTestFile();
var date = DateTimeOffset.Parse("2018/11/28");
var r = await client.Reports.CreateFillReportAsync(date, date.AddDays(1),
"BTC-USD", email: "[email protected]");
var expectedBody =
$@"{{
""type"": ""fills"",
""start_date"": ""{date:O}"",
""end_date"": ""{date.AddDays(1):O}"",
""format"": ""pdf"",
""email"": ""[email protected]"",
""product_id"": ""BTC-USD""
}}";
server.ShouldHaveCalledSomePathAndQuery("/reports")
.WithSomeRequestBody(expectedBody)
.WithVerb(HttpMethod.Post);
await Verifier.Verify(r);
}
[Test]
public async Task get_report_status()
{
server.RespondWithJsonTestFile();
var r = await client.Reports.GetReportStatusAsync("fff");
r.Id.Should().Be("D94DF955-4A2C-4C08-80EA-CDA8249ED099");
r.Type.Should().Be(ReportType.Fills);
server.ShouldHaveCalledSomePathAndQuery("/reports/fff")
.WithVerb(HttpMethod.Get);
await Verifier.Verify(r);
}
}
}