public async Task GetCurrencies_response_is_not_null() { using (var api = new GdaxApiClient(FakeCredentials, sandbox: true)) { var currenciesClient = new CurrenciesClient(api); var result = await currenciesClient.GetCurrencies().SendAsync().ConfigureAwait(false); Assert.NotNull(result); } }
public async Task RequestsCorrectUrl() { var connection = Substitute.For <IApiConnection>(); var client = new CurrenciesClient(connection); await client.GetAll(); Received.InOrder(async() => { await connection.GetAll <Currency>(Arg.Is <Uri>(u => u.ToString() == "currencies")); }); }
public async Task RequestsCorrectUrlWithTerm() { var connection = Substitute.For <IApiConnection>(); var client = new CurrenciesClient(connection); await client.GetAll("fake"); Received.InOrder(async() => { await connection .GetAll <Currency>( Arg.Is <Uri>(u => u.ToString() == "currencies"), Arg.Is <Dictionary <string, string> >(d => d.Count == 1 && d["term"] == "fake")); }); }
public ViagogoClient( ProductHeaderValue product, IGogoKitConfiguration configuration, IOAuth2TokenStore tokenStore, IJsonSerializer serializer, IHttpConnection oauthConnection, IHttpConnection apiConnection) { Requires.ArgumentNotNull(product, nameof(product)); Requires.ArgumentNotNull(configuration, nameof(configuration)); Requires.ArgumentNotNull(tokenStore, nameof(tokenStore)); Requires.ArgumentNotNull(serializer, nameof(serializer)); Requires.ArgumentNotNull(oauthConnection, nameof(oauthConnection)); Requires.ArgumentNotNull(apiConnection, nameof(apiConnection)); var halKitConfiguration = new HalKitConfiguration(configuration.ViagogoApiRootEndpoint) { CaptureSynchronizationContext = configuration.CaptureSynchronizationContext }; Configuration = configuration; TokenStore = tokenStore; Hypermedia = new HalClient(halKitConfiguration, apiConnection); var linkFactory = new LinkFactory(configuration); OAuth2 = new OAuth2Client(oauthConnection, configuration); User = new UserClient(Hypermedia); Search = new SearchClient(Hypermedia); Addresses = new AddressesClient(User, Hypermedia, linkFactory); Purchases = new PurchasesClient(User, Hypermedia, linkFactory); Sales = new SalesClient(Hypermedia, linkFactory); Shipments = new ShipmentsClient(Hypermedia, linkFactory); PaymentMethods = new PaymentMethodsClient(User, Hypermedia, linkFactory); Countries = new CountriesClient(Hypermedia, linkFactory); Currencies = new CurrenciesClient(Hypermedia, linkFactory); Categories = new CategoriesClient(Hypermedia, linkFactory); Events = new EventsClient(Hypermedia); Listings = new ListingsClient(Hypermedia); Venues = new VenuesClient(Hypermedia); SellerListings = new SellerListingsClient(Hypermedia, linkFactory); Webhooks = new WebhooksClient(Hypermedia, linkFactory); BatchClient = new BatchClient(apiConnection, new ApiResponseFactory(serializer, halKitConfiguration), serializer, new LinkResolver()); }