コード例 #1
0
        public async Task <ResultWrapper <DepositDetailsForRpc> > ndm_getDeposit(Keccak depositId)
        {
            var deposit = await _consumerService.GetDepositAsync(depositId);

            return(deposit == null
                ? ResultWrapper <DepositDetailsForRpc> .Fail($"Deposit: '{depositId}' was not found.")
                : ResultWrapper <DepositDetailsForRpc> .Success(new DepositDetailsForRpc(deposit)));
        }
コード例 #2
0
        public async Task <ResultWrapper <DepositDetailsForRpc> > ndm_getDeposit(Keccak depositId)
        {
            uint           timestamp = (uint)_timestamper.UnixTime.Seconds;
            DepositDetails?deposit   = await _consumerService.GetDepositAsync(depositId);

            return(deposit is null
                ? ResultWrapper <DepositDetailsForRpc> .Fail($"Deposit: '{depositId}' was not found.")
                : ResultWrapper <DepositDetailsForRpc> .Success(new DepositDetailsForRpc(deposit, timestamp)));
        }
コード例 #3
0
        public async Task get_deposit_should_return_deposit()
        {
            var depositId = TestItem.KeccakA;

            _consumerService.GetDepositAsync(depositId).Returns(GetDepositDetails());
            var result = await _rpc.ndm_getDeposit(depositId);

            await _consumerService.Received().GetDepositAsync(depositId);

            result.Result.ResultType.Should().Be(ResultType.Success);
            result.ErrorType.Should().Be(ErrorType.None);
            result.Result.Error.Should().BeNullOrWhiteSpace();
            VerifyDepositDetails(result.Data);
        }