Beispiel #1
0
        public async Task ExpenseRepository_DeleteExpense_Deleted_NotFail_Test()
        {
            var context  = new MyCompanyContext();
            var expense  = context.Expenses.FirstOrDefault();
            int expected = context.Expenses.Count() - 1;

            await target.DeleteAsync(expense.ExpenseId);

            int actual = context.Expenses.Count();

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        public async Task DeleteAndDetailAsyncTest()
        {
            var repository = new ExpenseRepository(GetContext());

            var expense = await repository.DetailAsync(1);

            Assert.NotNull(expense);

            await repository.DeleteAsync(expense);

            Assert.Null(await repository.DetailAsync(1));
        }
        public async Task <IHttpActionResult> DeleteExpense(Expense parameter)
        {
            await _repository.DeleteAsync(parameter.Id);

            return(Ok());
        }