public void FindAddressesForTransactionWithMatchingTransactionsReturnsTransactions() { var account = new HdAccount(); account.ExternalAddresses.Add(new HdAddress { Index = 2, Transactions = new List <TransactionData> { new TransactionData { Id = new uint256(15), Index = 7 } } }); account.ExternalAddresses.Add(new HdAddress { Index = 3, Transactions = new List <TransactionData> { new TransactionData { Id = new uint256(18), Index = 8 } } }); account.ExternalAddresses.Add(new HdAddress { Index = 1, Transactions = new List <TransactionData> { new TransactionData { Id = new uint256(19), Index = 9 } } }); account.ExternalAddresses.Add(new HdAddress { Index = 6, Transactions = null }); account.InternalAddresses.Add(new HdAddress { Index = 4, Transactions = new List <TransactionData> { new TransactionData { Id = new uint256(15), Index = 10 } } }); account.InternalAddresses.Add(new HdAddress { Index = 5, Transactions = new List <TransactionData> { new TransactionData { Id = new uint256(18), Index = 11 } } }); account.InternalAddresses.Add(new HdAddress { Index = 6, Transactions = null }); account.InternalAddresses.Add(new HdAddress { Index = 6, Transactions = new List <TransactionData> { new TransactionData { Id = new uint256(19), Index = 12 } } }); IEnumerable <HdAddress> result = account.FindAddressesForTransaction(t => t.Id == 18); Assert.Equal(2, result.Count()); Assert.Equal(3, result.ElementAt(0).Index); Assert.Equal(5, result.ElementAt(1).Index); }
public void FindAddressesForTransactionWithoutMatchingTransactionsReturnsEmptyList() { var account = new HdAccount(); account.ExternalAddresses.Add(new HdAddress { Index = 2, Transactions = new List <TransactionData> { new TransactionData { Id = new uint256(15), Index = 7 } } }); account.ExternalAddresses.Add(new HdAddress { Index = 3, Transactions = new List <TransactionData> { new TransactionData { Id = new uint256(18), Index = 8 } } }); account.ExternalAddresses.Add(new HdAddress { Index = 1, Transactions = new List <TransactionData> { new TransactionData { Id = new uint256(19), Index = 9 } } }); account.ExternalAddresses.Add(new HdAddress { Index = 6, Transactions = null }); account.InternalAddresses.Add(new HdAddress { Index = 4, Transactions = new List <TransactionData> { new TransactionData { Id = new uint256(15), Index = 10 } } }); account.InternalAddresses.Add(new HdAddress { Index = 5, Transactions = new List <TransactionData> { new TransactionData { Id = new uint256(18), Index = 11 } } }); account.InternalAddresses.Add(new HdAddress { Index = 6, Transactions = null }); account.InternalAddresses.Add(new HdAddress { Index = 6, Transactions = new List <TransactionData> { new TransactionData { Id = new uint256(19), Index = 12 } } }); IEnumerable <HdAddress> result = account.FindAddressesForTransaction(t => t.Id == 25); Assert.Empty(result); }