Ejemplo n.º 1
0
        public void Delete_Passes_Correct_Expense_To_View()
        {
            var expenseId       = 42;
            var expectedExpense = new Expense();

            expenseRepo.GetById(expenseId).Returns(expectedExpense);

            var result = underTest.Delete(expenseId);
            var model  = ((ViewResult)result).Model;

            Assert.Same(expectedExpense, model);
        }
Ejemplo n.º 2
0
        public void DeleteExpense()
        {
            this.ResetMocks();

            var mockCategory = this.CreateCategory();

            _categoryRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(mockCategory);

            var expense = this.CreateExpense(mockCategory);

            _expensesRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(expense);

            var expCont = new ExpensesController(_expensesRepository.Object, _categoryRepository.Object);

            expCont.Delete(It.IsAny <int>());
            _expensesRepository.Verify(x => x.Delete(It.IsAny <int>()), Times.Once);
        }