-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #54 - Better pagination support.
- Loading branch information
Showing
18 changed files
with
214 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System.Threading.Tasks; | ||
using Coinbase.Models; | ||
using NUnit.Framework; | ||
using static Coinbase.Tests.Examples; | ||
|
||
namespace Coinbase.Tests.Endpoints | ||
{ | ||
public class PaginationTests : OAuthServerTest | ||
{ | ||
[Test] | ||
public async Task page_accounts() | ||
{ | ||
await client.Accounts.ListAccountsAsync(new PaginationOptions {Limit = 5, EndingBefore = "before", Order = "ooo", StartingAfter = "after"}); | ||
|
||
server.ShouldHaveExactCall("https://api.coinbase.com/v2/accounts?limit=5&order=ooo&starting_after=after&ending_before=before"); | ||
} | ||
|
||
[Test] | ||
public async Task page_addresses() | ||
{ | ||
await client.Addresses.ListAddressesAsync("fff", new PaginationOptions { Limit = 5,Order = "ooo" }); | ||
|
||
server.ShouldHaveExactCall("https://api.coinbase.com/v2/accounts/fff/addresses?limit=5&order=ooo"); | ||
} | ||
|
||
[Test] | ||
public async Task can_get_next_page() | ||
{ | ||
var p = new PagedResponse<Buy>() | ||
{ | ||
Pagination = new Pagination { NextUri = "/v2/next/thing?limit=5" } | ||
}; | ||
|
||
await client.GetNextPageAsync(p); | ||
|
||
server.ShouldHaveExactCall("https://api.coinbase.com/v2/next/thing?limit=5"); | ||
} | ||
|
||
//[Test] | ||
//public async Task can_get_prev_page() | ||
//{ | ||
// var p = new PagedResponse<Buy>() | ||
// { | ||
// Pagination = new Pagination { PreviousUri = "/v2/prev/thing?limit=5" } | ||
// }; | ||
|
||
// await client.PreviousPageAsync(p); | ||
|
||
// server.ShouldHaveExactCall("https://api.coinbase.com/v2/prev/thing?limit=5"); | ||
//} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.