-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d840db7
commit 122356d
Showing
14 changed files
with
284 additions
and
63 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
23 changes: 23 additions & 0 deletions
23
GDAXClient.Specs/JsonFixtures/Accounts/AccountHoldsResponseFixture.cs
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,23 @@ | ||
namespace GDAXClient.Specs.JsonFixtures.Accounts | ||
{ | ||
public static class AccountHoldsResponseFixture | ||
{ | ||
public static string Create() | ||
{ | ||
var json = @" | ||
[ | ||
{ | ||
""id"": ""82dcd140-c3c7-4507-8de4-2c529cd1a28f"", | ||
""account_id"": ""e0b3f39a-183d-453e-b754-0c13e5bab0b3"", | ||
""created_at"": ""2016-12-08T24:00:00Z"", | ||
""updated_at"": ""2016-12-08T24:00:00Z"", | ||
""amount"": ""4.23"", | ||
""type"": ""order"", | ||
""ref"": ""0a205de4-dd35-4370-a285-fe8fc375a273"", | ||
} | ||
]"; | ||
|
||
return json; | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
GDAXClient.Specs/JsonFixtures/Currencies/CurrenciesResponseFixture.cs
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,21 @@ | ||
namespace GDAXClient.Specs.JsonFixtures.Currencies | ||
{ | ||
public static class CurrenciesResponseFixture | ||
{ | ||
public static string Create() | ||
{ | ||
var json = @" | ||
[{ | ||
""id"": ""BTC"", | ||
""name"": ""Bitcoin"", | ||
""min_size"": ""0.00000001"" | ||
}, { | ||
""id"": ""USD"", | ||
""name"": ""United States Dollar"", | ||
""min_size"": ""0.01000000"" | ||
}]"; | ||
|
||
return json; | ||
} | ||
} | ||
} |
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
57 changes: 57 additions & 0 deletions
57
GDAXClient.Specs/Services/Currencies/CurrenciesServiceSpecs.cs
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,57 @@ | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using GDAXClient.Authentication; | ||
using GDAXClient.HttpClient; | ||
using GDAXClient.Services.HttpRequest; | ||
using Machine.Fakes; | ||
using Machine.Specifications; | ||
using GDAXClient.Services.Currencies; | ||
using System.Collections.Generic; | ||
using GDAXClient.Specs.JsonFixtures.Currencies; | ||
using System.Linq; | ||
using GDAXClient.Services.Currencies.Models; | ||
|
||
namespace GDAXClient.Specs.Services.Deposits | ||
{ | ||
[Subject("CurrenciesService")] | ||
public class CurrenciesServiceSpecs : WithSubject<CurrenciesService> | ||
{ | ||
static Authenticator authenticator; | ||
|
||
static IEnumerable<Currency> result; | ||
|
||
Establish context = () => | ||
authenticator = new Authenticator("apiKey", new string('2', 100), "passPhrase"); | ||
|
||
class when_getting_all_currencies | ||
{ | ||
Establish context = () => | ||
{ | ||
The<IHttpRequestMessageService>().WhenToldTo(p => p.CreateHttpRequestMessage(Param.IsAny<HttpMethod>(), Param.IsAny<Authenticator>(), Param.IsAny<string>(), Param.IsAny<string>())) | ||
.Return(new HttpRequestMessage()); | ||
|
||
The<IHttpClient>().WhenToldTo(p => p.SendASync(Param.IsAny<HttpRequestMessage>())) | ||
.Return(Task.FromResult(new HttpResponseMessage())); | ||
|
||
The<IHttpClient>().WhenToldTo(p => p.ReadAsStringAsync(Param.IsAny<HttpResponseMessage>())) | ||
.Return(Task.FromResult(CurrenciesResponseFixture.Create())); | ||
}; | ||
|
||
Because of = () => | ||
result = Subject.GetAllCurrenciesAsync().Result; | ||
|
||
It should_return_a_correct_number_of_currencies = () => | ||
result.Count().ShouldEqual(2); | ||
|
||
It should_return_a_correct_response = () => | ||
{ | ||
result.First().Id.ShouldEqual("BTC"); | ||
result.First().Name.ShouldEqual("Bitcoin"); | ||
result.First().Min_size.ShouldEqual(0.00000001M); | ||
result.Skip(1).First().Id.ShouldEqual("USD"); | ||
result.Skip(1).First().Name.ShouldEqual("United States Dollar"); | ||
result.Skip(1).First().Min_size.ShouldEqual(0.01000000M); | ||
}; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
|
||
namespace GDAXClient.Services.Accounts.Models | ||
{ | ||
public class AccountHold | ||
{ | ||
public string Id { get; set; } | ||
|
||
public string Account_id { get; set; } | ||
|
||
public DateTime Created_at { get; set; } | ||
|
||
public DateTime Updated_at { get; set; } | ||
|
||
public decimal Amount { get; set; } | ||
|
||
public string Type { get; set; } | ||
|
||
public string @Ref { get; set; } | ||
} | ||
} |
Oops, something went wrong.