public void CanDetectInvalidAddress()
        {
            PrepareNetworks.EnsureVertcoinPrepared();

            var invalidAddress   = "invalid";
            var addressValidator = new AddressValidator();

            Assert.False(addressValidator.IsValid(invalidAddress));
        }
Exemplo n.º 2
0
        public async Task CanCalculateFeeForTx()
        {
            PrepareNetworks.EnsureVertcoinPrepared();

            var feePerByte     = 100;
            var feeRateService = CreateFeeRateFacade(feePerByte);

            var feeFacade = new FeeService(feeRateService.Object, 100, 1000);

            var txBuilder = GetTestTx(Network.RegTest);

            await feeFacade.CalcFeeForTransaction(txBuilder.BuildTransaction(true));
        }
Exemplo n.º 3
0
        public async Task ReturnsFeeMaxValueIfCalculatedFeeBiggerThanMaxValue()
        {
            PrepareNetworks.EnsureVertcoinPrepared();

            var feePerByte     = 9999;
            var feeRateService = CreateFeeRateFacade(feePerByte);

            var feeMaxValue = 1000;
            var feeFacade   = new FeeService(feeRateService.Object, 100, feeMaxValue);

            var txBuilder = GetTestTx(Network.RegTest);

            var fee = await feeFacade.CalcFeeForTransaction(txBuilder.BuildTransaction(true));

            Assert.True(fee.Satoshi == feeMaxValue);
        }
        public void CanPassValidAddress()
        {
            PrepareNetworks.EnsureVertcoinPrepared();


            var addresses = new[]
            {
                "mu5a17UQDh2hsRk9ZJzFkTfCbzZhMVBHY3",
                "mifUh8hTMomrQL1dyVykffhcsYAfExzdxa",
                "msiJHQf1BVXD6fuUyLn9D8mD6gMbPibiDV",
                "LLgJTbzZMsRTCUF1NtvvL9SR1a4pVieW89",
                "Le6rZj8bLTbUATVhcZBxd3Z1u8b542C63T"
            };
            var addressValidator = new AddressValidator();

            foreach (var address in addresses)
            {
                Assert.True(addressValidator.IsValid(address));
            }
        }