コード例 #1
0
        public async Task TransactionShouldBeAddedUsingAccount()
        {
            var acc         = new AccountFactory(_dbContext).WithDefaultValues().Build();
            var transaction = new TransactionFactory().WithDefaultValues().Build();

            acc.AddCredit(transaction);

            var repo = await GetRepository <Account>();

            Func <Task> add = async() => {
                await repo.AddAsync(acc, default);
            };

            add.Should().NotThrow();
            acc.Transactions.Should().HaveCount(1);
            acc.GetCurrentBalance().Should().Be(transaction.Value);
        }