Esempio n. 1
0
        public void Can_Delete_Saved_Income()
        {
            var service     = new IncomeService(_mockIncomeRepository.Object);
            var savedIncome = _sampleIncomes[0];

            service.DeleteIncome(savedIncome.Id);
            _mockIncomeRepository.Verify(x => x.Delete(It.Is <int>(input =>
                                                                   input == savedIncome.Id)
                                                       ));
        }
        public async Task <IActionResult> DeleteIncome([FromRoute] string incomeId)
        {
            try
            {
                if (incomeId == null)
                {
                    throw new NullReferenceException();
                }
                await _incomeService.DeleteIncome(userId, incomeId);

                return(Ok());
            }
            catch (Exception e)
            {
                return(NotFound());
            }
        }