public async Task ShouldGetDebitById()
        {
            var debit = new Debit(1);

            var expectedDebit = DebitMap.DebitToDebitResponse(debit);

            _debitRepository.GetById(1).Returns(debit);

            var response = await _debitService.GetById(1);

            response.Should().BeEquivalentTo(expectedDebit);
        }
Esempio n. 2
0
        public async Task <DebitResponseModel> GetById(int id)
        {
            if (id <= 0)
            {
                AddError("Id invalid");
            }

            HandlerErrors();

            var debit = await _debitRepository.GetById(id);

            if (debit == null)
            {
                AddError("Debit not found");
            }

            HandlerErrors();

            return(DebitMap.DebitToDebitResponse(debit));
        }