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 UpdateAndDetailAsyncTest() { var repository = new ExpenseRepository(GetContext()); var expense = await repository.DetailAsync(1); Assert.Equal("Alice", expense.Recipient); expense.Recipient = "Bob"; await repository.UpdateAsync(expense); var newExpense = await repository.DetailAsync(1); Assert.Equal("Bob", newExpense.Recipient); }
public async Task DetailAsyncTest() { var repository = new ExpenseRepository(GetContext()); var expense = await repository.DetailAsync(1); Assert.Equal("Alice", expense.Recipient); }
public async Task InsertAndDetailAsyncTest() { var repository = new ExpenseRepository(GetContext()); var expense = new Expense { Id = 0, TransactionDate = DateTime.Today, Type = ExpenseType.Drink, Recipient = "test recipient", Amount = 123, Currency = "CHF" }; await repository.CreateAsync(expense); Assert.NotEqual(0, expense.Id); var expenseFromDb = await repository.DetailAsync(expense.Id); Assert.Equal("test recipient", expenseFromDb.Recipient); }