コード例 #1
0
        public void Data_Update_Account()
        {
            var repository = new AccountRepository(_dataConnectionString, 1);

            var account = repository.Get(1);

            account.Name = "UPDATED";
            account.StartingBalance = 256.12M;
            account.Default = false;
            account.Type = AccountType.CreditCard;
            account.DisplayOrder = 126;
            account.IncludeInNetWorth = false;

            var result = repository.Update(account);

            Assert.IsTrue(result.Name == "UPDATED");
            Assert.IsTrue(result.StartingBalance == 256.12M);
            Assert.IsTrue(result.Default == false);
            Assert.IsTrue(result.Type == AccountType.CreditCard);
            Assert.IsTrue(result.DisplayOrder == 126);
            // This will have been updated by the total calc trigger when the test transactions are inserted
            Assert.IsTrue(result.CurrentBalance == 501.12M);
            Assert.IsTrue(result.LastModifiedBy == 1);
            Assert.IsTrue(result.LastModifiedDate.Date == DateTime.Now.Date);
        }