public void CreateTransaction()
        {
            var userRepo        = new UserRepository();
            var accountRepo     = new AccountRepository();
            var transactionRepo = new TransactionRepository();

            var user    = TestEntityMaker.GetUser();
            var account = TestEntityMaker.GetAccount();

            userRepo.Add(user);
            accountRepo.Add(account);

            var transaction = new Business.Entities.Transaction();

            transaction.TransactionDate = DateTime.Now;
            transaction.Payee           = "The Man";
            transaction.AccountId       = account.Id;

            transactionRepo.Add(transaction);

            using (var context = new MacroMoneyContext())
            {
                var result = context.Account
                             .Include(i => i.Transactions)
                             .Where(e => e.Id == account.Id);

                Assert.IsTrue(result.Any());
            }
        }
コード例 #2
0
        public void SetUp()
        {
            trans  = new TransactionScope(TransactionScopeOption.Required);
            myUser = TestEntityMaker.GetUser();

            var userRepo = new UserRepository();

            userRepo.Add(myUser);
        }