public async void GetTransaction_BadIds_ArgumentExecption()
        {
            await Assert.ThrowsAsync <ArgumentNullException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    await apiHelper.BlockExpolorer.GetTransactionAsync(null);
                }
            });

            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    await apiHelper.BlockExpolorer.GetTransactionByIndexAsync(-1);
                }
            });
        }
Пример #2
0
        public async void GetChart_WrongTimespan_OutOfRangeException()
        {
            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    await apiHelper.statisticsExplorer.GetChartAsync("hash-rate", "wrong-timespan-format");
                }
            });

            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    await apiHelper.statisticsExplorer.GetPoolsAsync(0);
                }
            });
        }
Пример #3
0
        public async void ReceiveFunds_NullParameters_ArgumentNullExceptions()
        {
            await Assert.ThrowsAsync <ArgumentNullException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    await apiHelper.FundReceiver.ReceiveFundsAsync(null, "callback");
                }
            });

            await Assert.ThrowsAsync <ArgumentNullException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    await apiHelper.FundReceiver.ReceiveFundsAsync("address", null);
                }
            });
        }
Пример #4
0
        public async void GetBlocks_BadParameters_ArgumentException()
        {
            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    await apiHelper.blockExplorer.GetBlocksByTimestampAsync(-1);
                }
            });


            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    await apiHelper.blockExplorer.GetBlocksByTimestampAsync(1000);
                }
            });

            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    await apiHelper.blockExplorer.GetBlocksByTimestampAsync(int.MaxValue);
                }
            });


            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    await apiHelper.blockExplorer.GetBlocksByDateTimeAsync(DateTime.MinValue);
                }
            });

            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    await apiHelper.blockExplorer.GetBlocksByDateTimeAsync(DateTime.MaxValue);
                }
            });
        }
Пример #5
0
        public async void FromBtc_NegativeValue_ArgumentOutOfRangeException()
        {
            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    var btc = new BitcoinValue(new decimal(-0.4));
                    await apiHelper.exchangeRateExplorer.FromBtcAsync(btc);
                }
            });

            await Assert.ThrowsAsync <ArgumentNullException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    await apiHelper.exchangeRateExplorer.FromBtcAsync(null);
                }
            });
        }
Пример #6
0
        public async void SendMany_NullReeipients_ArgumentNUllException()
        {
            await Assert.ThrowsAsync <ArgumentException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    WalletHelper walletHelper = this.GetWalletHelper(apiHelper);
                    await walletHelper.SendManyAsync(null);
                }
            });

            await Assert.ThrowsAsync <ArgumentException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    WalletHelper walletHelper = this.GetWalletHelper(apiHelper);
                    await walletHelper.SendManyAsync(new Dictionary <string, BitcoinValue>());
                }
            });
        }
Пример #7
0
        public async void Send_BadParameters_ArgumentExceptions()
        {
            await Assert.ThrowsAsync <ArgumentNullException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    WalletHelper walletHelper = this.GetWalletHelper(apiHelper);
                    await walletHelper.SendAsync(null, BitcoinValue.Zero);
                }
            });

            await Assert.ThrowsAsync <ArgumentException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    WalletHelper walletHelper = this.GetWalletHelper(apiHelper);
                    await walletHelper.SendAsync("Test", BitcoinValue.FromBtc(-1));
                }
            });
        }
Пример #8
0
        public async void GetAddress_BadParameters_ArgumentExceptions()
        {
            await Assert.ThrowsAsync <ArgumentNullException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    WalletHelper walletHelper = this.GetWalletHelper(apiHelper);
                    await walletHelper.GetAddressAsync(null);
                }
            });

            await Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() =>
            {
                using (BlockchainApiHelper apiHelper = UnitTestUtil.GetFakeHelper())
                {
                    WalletHelper walletHelper = this.GetWalletHelper(apiHelper);
                    await walletHelper.GetAddressAsync("Test", -1);
                }
            });
        }