Exemplo n.º 1
0
        public void CheckingAccounts_Service_Update_Should_Be_OK()
        {
            //Arrange
            var returns = true;

            _mockRepositoryAccount.Setup(r => r.GetById(_checkingAccount.Id))
            .Returns(_checkingAccount);

            _mockRepositoryAccount.Setup(r => r.Update(_checkingAccount))
            .Returns(returns);

            //Action
            var idInsert = _service.Update(_checkingAccountUpdate);

            //Verify
            idInsert.Should().Be(returns);
            _mockRepositoryAccount.Verify(r => r.GetById(It.IsAny <long>()));
            _mockRepositoryAccount.Verify(r => r.Update(It.IsAny <CheckingAccount>()));
        }
Exemplo n.º 2
0
        public IHttpActionResult Update(CheckingAccountUpdateCommand cmd)
        {
            var validator = cmd.Validate();

            if (!validator.IsValid)
            {
                return(HandleValidationFailure(validator.Errors));
            }

            return(HandleCallback(() => _accountsService.Update(cmd)));
        }
        public IActionResult Put(int id, [FromBody] CheckingAccount checkingAccount)
        {
            if (id != checkingAccount.Id)
            {
                return(BadRequest("Error: [id] checking account object id not equals url id"));
            }

            _checkingAccountService.Update(checkingAccount);

            return(NoContent());
        }
Exemplo n.º 4
0
        public void CheckingAccounts_Service_Update_Should_Be_OK()
        {
            //Arrange
            var returns = true;

            _mockRepositoryAccount.Setup(r => r.GetById(_checkingAccount.Id))
            .Returns(_checkingAccount);

            _mockRepositoryAccount.Setup(r => r.Update(_checkingAccount))
            .Returns(returns);

            _mockRepositoryTransaction.Setup(r => r.Add(_checkingAccount.Transactions.First()))
            .Returns(_checkingAccount.Transactions.First());

            //Action
            var idInsert = _service.Update(_checkingAccount);

            //Verify
            idInsert.Should().Be(returns);
            _mockRepositoryAccount.Verify(r => r.GetById(_checkingAccount.Id));
            _mockRepositoryAccount.Verify(r => r.Update(_checkingAccount));
            _mockRepositoryTransaction.Verify(r => r.Add(_checkingAccount.Transactions.First()));
        }
Exemplo n.º 5
0
 public IHttpActionResult Update(CheckingAccount account)
 {
     return(HandleCallback(() => _accountsService.Update(account)));
 }