示例#1
0
        public void Controller_Contas_EfetuarTransferencia_DevePassar()
        {
            // Arrange
            var contaOrigem  = ContaObjectMother.GetContaValida();
            var contaDestino = ContaObjectMother.GetContaValidaParaAtualizar();

            contaDestino.Id = 2;
            var isUpdated = true;
            var valor     = 100;

            _contaServiceMock.Setup(c => c.EfetuarTrasferencia(contaOrigem.Id, contaDestino.Id, valor)).Returns(isUpdated);
            // Action
            IHttpActionResult callback = _contasController.EfetuarTransferencia(contaOrigem.Id, contaDestino.Id, valor);
            // Assert
            var httpResponse = callback.Should().BeOfType <OkNegotiatedContentResult <bool> >().Subject;

            httpResponse.Content.Should().BeTrue();
            _contaServiceMock.Verify(s => s.EfetuarTrasferencia(contaOrigem.Id, contaDestino.Id, valor), Times.Once);
        }