public void Test_AddNewIncome_Fail_IncomeNotProvided() { var incomeServices = new BudgetIncomeServices(_incomeRepository.Object); Assert.ThrowsAsync <ArgumentException>(() => incomeServices.AddNewIncome(null)); _incomeRepository.Verify(i => i.AddNewIncome(It.IsAny <BudgetIncome>()), Times.Never); }
public async Task Test_AddNewIncome_Success() { _incomeRepository.Setup(i => i.AddNewIncome(It.IsAny <BudgetIncome>())) .Returns(Task.CompletedTask); var incomeServices = new BudgetIncomeServices(_incomeRepository.Object); await incomeServices.AddNewIncome(new BudgetIncomeModel() { UserId = 1, Amount = 5, IncomeType = "Pay Check" }); _incomeRepository.Verify(i => i.AddNewIncome(It.IsAny <BudgetIncome>()), Times.Once); }