public async Task EventsAreTriggerInChain(Int32 n, Int32 expected)
        {
            await using var expenseDbContext = GetDbContext();

            var expense = new Expense(new ExpenseNumber(n.ToString()), ExpenseType.Hobby);

            expense.AddDomainEvent();
            expenseDbContext.Expenses.Add(expense);

            await expenseDbContext.SaveChangesAsync();

            Assert.Equal(expected, await expenseDbContext.Expenses.CountAsync());
        }
        public async Task EventsAreTriggerOnlyOnce()
        {
            await using var expenseDbContext = GetDbContext();

            var expense = new Expense(new ExpenseNumber("1"), ExpenseType.Hobby);

            expense.AddDomainEvent();
            expenseDbContext.Expenses.Add(expense);

            await expenseDbContext.SaveChangesAsync();

            Assert.Empty(expense.DomainEvents);
        }
        public async Task EventsAreTriggerAfterTransactionCommit()
        {
            await using var expenseDbContext = GetDbContext();

            var expense = new Expense(new ExpenseNumber("1"), ExpenseType.Hobby);

            expense.AddDomainEvent();
            expenseDbContext.Expenses.Add(expense);

            await using var transaction = await expenseDbContext.BeginTransactionAsync();

            await expenseDbContext.SaveChangesAsync();

            Assert.NotEmpty(expense.DomainEvents);

            await expenseDbContext.CommitTransactionAsync(transaction);

            Assert.Empty(expense.DomainEvents);
        }