public void Data_Create_Account() { var repository = new AccountRepository(_dataConnectionString, 1); var account = new MABMoney.Domain.Account { Name = "ADDED", StartingBalance = 123.45M, Default = true, Type = AccountType.Savings, DisplayOrder = 50, IncludeInNetWorth = false }; var result = repository.Add(account); Assert.IsTrue(result.AccountID == 6); Assert.IsTrue(result.Name == "ADDED"); Assert.IsTrue(result.StartingBalance == 123.45M); Assert.IsTrue(result.Default == true); Assert.IsTrue(result.Type == AccountType.Savings); Assert.IsTrue(result.DisplayOrder == 50); Assert.IsTrue(result.User_UserID == 1); Assert.IsTrue(result.CreatedBy == 1); Assert.IsTrue(result.CreatedDate.Date == DateTime.Now.Date); Assert.IsTrue(result.LastModifiedBy == 1); Assert.IsTrue(result.LastModifiedDate.Date == DateTime.Now.Date); Assert.IsTrue(result.CurrentBalance == 123.45M); Assert.IsTrue(result.IncludeInNetWorth == false); }
public Account Add(Account account) { return AddOrUpdate<Account>("mm_Accounts_Create", new { UserID = _userId, Name = account.Name, StartingBalance = account.StartingBalance, Default = account.Default, Type = account.Type, DisplayOrder = account.DisplayOrder, IncludeInNetWorth = account.IncludeInNetWorth }); }
public Account Update(Account account) { return AddOrUpdate<Account>("mm_Accounts_Update", new { UserID = _userId, AccountID = account.AccountID, Name = account.Name, StartingBalance = account.StartingBalance, Default = account.Default, Type = account.Type, DisplayOrder = account.DisplayOrder, IncludeInNetWorth = account.IncludeInNetWorth, TransactionDescriptionHistory = account.TransactionDescriptionHistory }); }