public void GetFirstUnusedChangeAddressWithoutChangeAddressReturnsNull()
        {
            var account = new HdAccount();

            HdAddress result = account.GetFirstUnusedChangeAddress();

            Assert.Null(result);
        }
示例#2
0
        public void GetFirstUnusedChangeAddressWithoutChangeAddressReturnsNull()
        {
            var account = new HdAccount();

            account.InternalAddresses.Clear();

            var result = account.GetFirstUnusedChangeAddress();

            Assert.Null(result);
        }
示例#3
0
        public void GetFirstUnusedChangeAddressWithoutChangeAddressReturnsNull()
        {
            var store   = new WalletMemoryStore();
            var account = new HdAccount();

            account.InternalAddresses.Clear();

            HdAddress result = account.GetFirstUnusedChangeAddress(store);

            Assert.Null(result);
        }
        public void GetFirstUnusedChangeAddressWithoutExistingUnusedChangeAddressReturnsNull()
        {
            var account = new HdAccount();

            account.InternalAddresses.Add(new HdAddress {
                Index = 2, Transactions = new List <TransactionData> {
                    new TransactionData()
                }
            });
            account.InternalAddresses.Add(new HdAddress {
                Index = 1, Transactions = new List <TransactionData> {
                    new TransactionData()
                }
            });

            HdAddress result = account.GetFirstUnusedChangeAddress();

            Assert.Null(result);
        }
        public void GetFirstUnusedChangeAddressWithExistingUnusedChangeAddressReturnsAddressWithLowestIndex()
        {
            var account = new HdAccount();

            account.InternalAddresses.Add(new HdAddress {
                Index = 3
            });
            account.InternalAddresses.Add(new HdAddress {
                Index = 2
            });
            account.InternalAddresses.Add(new HdAddress {
                Index = 1, Transactions = new List <TransactionData> {
                    new TransactionData()
                }
            });

            HdAddress result = account.GetFirstUnusedChangeAddress();

            Assert.Equal(account.InternalAddresses.ElementAt(1), result);
        }
示例#6
0
        public void GetFirstUnusedChangeAddressWithExistingUnusedChangeAddressReturnsAddressWithLowestIndex()
        {
            var store   = new WalletMemoryStore();
            var account = new HdAccount();

            account.InternalAddresses.Add(new HdAddress {
                Index = 3, Address = "3"
            });
            account.InternalAddresses.Add(new HdAddress {
                Index = 2, Address = "2"
            });
            account.InternalAddresses.Add(new HdAddress {
                Index = 1, Address = "1"
            }); store.Add(new List <TransactionOutputData> {
                new TransactionOutputData {
                    OutPoint = new OutPoint(new uint256(1), 1), Address = "1"
                }
            });

            HdAddress result = account.GetFirstUnusedChangeAddress(store);

            Assert.Equal(account.InternalAddresses.ElementAt(1), result);
        }
示例#7
0
        public void GetFirstUnusedChangeAddressWithoutExistingUnusedChangeAddressReturnsNull()
        {
            var store   = new WalletMemoryStore();
            var account = new HdAccount();

            account.InternalAddresses.Add(new HdAddress {
                Index = 2, Address = "2"
            }); store.Add(new List <TransactionOutputData> {
                new TransactionOutputData {
                    OutPoint = new OutPoint(new uint256(1), 1), Address = "2"
                }
            });
            account.InternalAddresses.Add(new HdAddress {
                Index = 1, Address = "1"
            }); store.Add(new List <TransactionOutputData> {
                new TransactionOutputData {
                    OutPoint = new OutPoint(new uint256(2), 1), Address = "1"
                }
            });

            HdAddress result = account.GetFirstUnusedChangeAddress(store);

            Assert.Null(result);
        }