public void Test_RemoveIncome_Fail_IncomeRecordNotFound() { _incomeRepository.Setup(i => i.GetIncomeByIncomeId(It.IsAny <long>())); var incomeServices = new BudgetIncomeServices(_incomeRepository.Object); Assert.ThrowsAsync <Exception>(() => incomeServices.RemoveIncome(2)); _incomeRepository.Verify(i => i.RemoveIncome(It.IsAny <long>()), Times.Never); }
public async Task Test_RemoveIncome_Success() { _incomeRepository.Setup(i => i.GetIncomeByIncomeId(It.IsAny <long>())) .ReturnsAsync(new BudgetIncome()); _incomeRepository.Setup(i => i.RemoveIncome(It.IsAny <long>())) .Returns(Task.CompletedTask); var incomeServices = new BudgetIncomeServices(_incomeRepository.Object); await incomeServices.RemoveIncome(1); _incomeRepository.Verify(i => i.RemoveIncome(It.IsAny <long>()), Times.Once); }