Ejemplo n.º 1
0
        public async Task BuscarSaldoDeContaInexistente()
        {
            int     AccountNumber = 123;
            decimal BalanceAmmout = 120;

            _bankAccountRepository.Setup(x => x.FindAccount(AccountNumber))
            .Returns(Task.FromResult(new BankAccount {
                Number = AccountNumber, Balance = BalanceAmmout
            }));


            var balanceModel = new BalanceModel()
            {
                AccountNumber = 222
            };

            await Assert.ThrowsAsync <Exception>(async() => await _bankAccountService.AccountBalance(balanceModel));
        }
Ejemplo n.º 2
0
        public AccountBalanceQuery(IBankAccountService bankAccountService)
        {
            Field <DecimalGraphType>(
                "saldo",
                arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "conta"
            }),
                resolve: context => {
                var result = bankAccountService.AccountBalance(new BalanceModel()
                {
                    AccountNumber = context.GetArgument <int>("conta")
                });

                result.HandleErrors();

                return(result);
            }
                );
        }