-
-
Notifications
You must be signed in to change notification settings - Fork 93
/
DepositTests.cs
101 lines (77 loc) · 2.6 KB
/
DepositTests.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Coinbase.Models;
using FluentAssertions;
using NUnit.Framework;
using static Coinbase.Tests.Examples;
namespace Coinbase.Tests.Endpoints
{
public class DepositTests : OAuthServerTest
{
[Test]
public async Task can_list()
{
SetupServerPagedResponse(PaginationJson, $"{Deposit1}");
var r = await client.Deposits.ListDepositsAsync("fff");
var truth = new PagedResponse<Deposit>
{
Pagination = PaginationModel,
Data = new[]
{
Deposit1Model
}
};
truth.Should().BeEquivalentTo(r);
server.ShouldHaveExactCall("https://api.coinbase.com/v2/accounts/fff/deposits")
.WithVerb(HttpMethod.Get);
}
[Test]
public async Task can_get()
{
SetupServerSingleResponse(Deposit1);
var r = await client.Deposits.GetDepositAsync("fff", "uuu");
var truth = new Response<Deposit>
{
Data = Deposit1Model
};
truth.Should().BeEquivalentTo(r);
server.ShouldHaveExactCall($"https://api.coinbase.com/v2/accounts/fff/deposits/uuu")
.WithVerb(HttpMethod.Get);
}
[Test]
public async Task can_depositfunds()
{
SetupServerSingleResponse(Deposit1);
var create = new DepositFunds
{
Amount = 10.0m,
Currency = "USD",
PaymentMethod = "B28EB04F-BD70-4308-90A1-96065283A001"
};
var r = await client.Deposits.DepositFundsAsync("fff", create );
var truth = new Response<Deposit>
{
Data = Deposit1Model
};
truth.Should().BeEquivalentTo(r);
server.ShouldHaveRequestBody(
@"{""amount"":10.0,""currency"":""USD"",""payment_method"":""B28EB04F-BD70-4308-90A1-96065283A001"",""commit"":false}");
server.ShouldHaveExactCall($"https://api.coinbase.com/v2/accounts/fff/deposits")
.WithVerb(HttpMethod.Post);
}
[Test]
public async Task can_commit()
{
SetupServerSingleResponse(Deposit1);
var r = await client.Deposits.CommitDepositAsync("fff", "uuu");
var truth = new Response<Deposit>
{
Data = Deposit1Model
};
truth.Should().BeEquivalentTo(r);
server.ShouldHaveExactCall("https://api.coinbase.com/v2/accounts/fff/deposits/uuu/commit")
.WithVerb(HttpMethod.Post);
}
}
}