public async Task Given_Address_Amount_When_Sending_Bitcoin_Then_Getting_Transaction_IdAsync() { //Arrange var request = new BitcoinRequest { Amount = 1, Address = "b21j21h3bu212j2jjj1jjjaaa" }; var executor = new Mock <DbExecutor>().Object; var transactionController = new TransactionController(executor); //Act var result = await transactionController.SendBtc(request); //Assert Assert.IsNotNull(result); }
public async Task <IHttpActionResult> SendBtc([FromBody] BitcoinRequest request) { var operations = new BitcoinOperations(WalletId, WalletPassword1, WalletPassword2); if (request == null) { throw new ArgumentNullException(nameof(request)); } BitcoinQuery query = Mapper.Map <BitcoinRequest, BitcoinQuery>(request); var bitcoinSend = await operations.Send(query.Address, BitcoinValue.FromBtc(query.Amount), WalletId); // This is fake bitcoin service but can be use as real if (bitcoinSend.TxHash != null) { await _dbExecutor.SaveTransactions(query); } return(Ok()); }