Ejemplo n.º 1
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));
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public async Task DetailAsyncTest()
        {
            var repository = new ExpenseRepository(GetContext());

            var expense = await repository.DetailAsync(1);

            Assert.Equal("Alice", expense.Recipient);
        }
Ejemplo n.º 4
0
        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);
        }