public async Task SmartBitTestsAsync(string networkString)
        {
            var network = Network.GetNetwork(networkString);

            using (var client = new SmartBitClient(network))
            {
                var rates = (await client.GetExchangeRatesAsync(CancellationToken.None));

                Assert.Contains("AUD", rates.Select(x => x.Code));
                Assert.Contains("USD", rates.Select(x => x.Code));

                await Assert.ThrowsAsync <HttpRequestException>(async() => await client.PushTransactionAsync(new Transaction(), CancellationToken.None));
            }
        }
Beispiel #2
0
        public async Task SmartBitTestsAsync(string networkString)
        {
            if (!await TestAsync("https://api.smartbit.com.au/v1/blockchain/stats"))
            {
                return;                 // If website doesn't work, don't bother failing.
            }

            var network = Network.GetNetwork(networkString);

            using (var client = new SmartBitClient(network))
            {
                IEnumerable <SmartBitExchangeRate> rates = rates = await client.GetExchangeRatesAsync(CancellationToken.None);

                Assert.Contains("AUD", rates.Select(x => x.Code));
                Assert.Contains("USD", rates.Select(x => x.Code));

                await Assert.ThrowsAsync <HttpRequestException>(async() => await client.PushTransactionAsync(new Transaction(), CancellationToken.None));
            }
        }
Beispiel #3
0
        public async Task SmartBitTestsAsync(string networkString)
        {
            var network = Network.GetNetwork(networkString);

            using (var client = new SmartBitClient(network))
            {
                IEnumerable <SmartBitExchangeRate> rates = null;
                try
                {
                    rates = await client.GetExchangeRatesAsync(CancellationToken.None);
                }
                catch                 // stupid CI internet conenction sometimes fails
                {
                    await Task.Delay(3000);

                    rates = await client.GetExchangeRatesAsync(CancellationToken.None);
                }

                Assert.Contains("AUD", rates.Select(x => x.Code));
                Assert.Contains("USD", rates.Select(x => x.Code));

                await Assert.ThrowsAsync <HttpRequestException>(async() => await client.PushTransactionAsync(new Transaction(), CancellationToken.None));
            }
        }