Ejemplo n.º 1
0
        public async Task Should_Update_Expense()
        {
            Guid   accountId = Guid.NewGuid();
            Guid   expenseId = Guid.NewGuid();
            string name      = "educação";

            Account account = AccountBuilder
                              .New
                              .WithId(accountId)
                              .WithExpenses(expenseId)
                              .Build();

            _accountReadOnlyRepository
            .Setup(x => x.Get(accountId))
            .ReturnsAsync(account);

            _accountWriteOnlyRepository
            .Setup(x => x.Update(account, It.IsAny <IFinanceStatement>()));

            await _updateFinanceStatementUseCase.Execute <Expense>(accountId, expenseId, name);

            _accountReadOnlyRepository.Verify(x => x.Get(accountId), Times.Once);
            _accountWriteOnlyRepository.Verify(x => x.Update(account, It.IsAny <IFinanceStatement>()), Times.Once);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Put([FromBody] UpdateFinanceStatementRequest request)
        {
            await _update.Execute <Investment>(request.AccountId, request.Id, request.Title);

            return(NoContent());
        }