public async Task get_pending_should_return_transactions_with_valid_type() { var deposits = new[] { GetDepositDetails(TestItem.KeccakA), GetDepositDetails(TestItem.KeccakB, TestItem.KeccakB) }; _depositRepository.BrowseAsync(Arg.Is <GetDeposits>(x => x.OnlyPending && x.Page == 1 && x.Results == int.MaxValue)) .Returns(PagedResult <DepositDetails> .Create(deposits, 1, 1, 1, 1)); var result = await _consumerTransactionsService.GetPendingAsync(); var transactions = result.ToList(); transactions.Count.Should().Be(2); var deposit = deposits[0]; var depositWithRefund = deposits[1]; var depositPendingTransaction = transactions.ElementAt(0); var refundPendingTransaction = transactions.ElementAt(1); depositPendingTransaction.Transaction.Hash.Should().Be(deposit.Transaction.Hash); depositPendingTransaction.Transaction.Value.Should().Be(deposit.Transaction.Value); depositPendingTransaction.Transaction.GasPrice.Should().Be(deposit.Transaction.GasPrice); depositPendingTransaction.Transaction.Timestamp.Should().Be(deposit.Transaction.Timestamp); depositPendingTransaction.Type.Should().Be("deposit"); refundPendingTransaction.Transaction.Hash.Should().Be(depositWithRefund.ClaimedRefundTransaction.Hash); refundPendingTransaction.Transaction.Value.Should().Be(depositWithRefund.ClaimedRefundTransaction.Value); refundPendingTransaction.Transaction.Hash.Should().Be(depositWithRefund.ClaimedRefundTransaction.Hash); refundPendingTransaction.Transaction.Timestamp.Should().Be(depositWithRefund.ClaimedRefundTransaction.Timestamp); refundPendingTransaction.Type.Should().Be("refund"); await _depositRepository.Received().BrowseAsync(Arg.Is <GetDeposits>(x => x.OnlyPending && x.Page == 1 && x.Results == int.MaxValue)); }
public async Task get_consumer_pending_transactions_should_return_data() { var pendingTransactions = new List <ResourceTransaction> { new ResourceTransaction(TestItem.KeccakA.ToString(), "test", TransactionInfo.Default(TestItem.KeccakB, 1.Ether(), 20.GWei(), 10, _timestamper.EpochSeconds)) }; var transaction = pendingTransactions[0]; _consumerTransactionsService.GetPendingAsync().Returns(pendingTransactions); var result = await _rpc.ndm_getConsumerPendingTransactions(); await _consumerTransactionsService.Received().GetPendingAsync(); result.Data.Should().NotBeEmpty(); result.Data.Should().ContainSingle(t => t.ResourceId == transaction.ResourceId && t.Type == transaction.Type && t.Transaction.Hash == transaction.Transaction.Hash && t.Transaction.Value == transaction.Transaction.Value && t.Transaction.GasPrice == transaction.Transaction.GasPrice && t.Transaction.GasLimit == transaction.Transaction.GasLimit && t.Transaction.MaxFee == transaction.Transaction.GasPrice * transaction.Transaction.GasLimit && t.Transaction.Timestamp == transaction.Transaction.Timestamp); }