public Transaction Add(Transaction transaction) { return AddOrUpdate<Transaction>("mm_Transactions_Create", new { UserID = _userId, Account_AccountID = transaction.Account_AccountID, Category_CategoryID = transaction.Category_CategoryID, Date = transaction.Date, Description = transaction.Description, Note = transaction.Note, Amount = transaction.Amount, TransferGUID = transaction.TransferGUID }); }
public void Data_Create_Transaction() { var repository = new TransactionRepository(_dataConnectionString, 1); var transaction = new MABMoney.Domain.Transaction { Account_AccountID = 1, Category_CategoryID = 3, Description = "ADDED", Amount = -10.25M, Date = new DateTime(2015, 1, 10, 18, 35, 10, 0), Note = "BISCUITS", TransferGUID = "5485364b-cac5-4c14-9638-5e7c0235a7c1" }; var result = repository.Add(transaction); Assert.IsTrue(result.TransactionID == 32); Assert.IsTrue(result.Account_AccountID == 1); Assert.IsTrue(result.AccountName == "Current"); Assert.IsTrue(result.Category_CategoryID == 3); Assert.IsTrue(result.CategoryName == "Food"); Assert.IsTrue(result.Description == "ADDED"); Assert.IsTrue(result.Amount == -10.25M); Assert.IsTrue(result.Date == new DateTime(2015, 1, 10, 18, 35, 10, 0)); Assert.IsTrue(result.Note == "BISCUITS"); Assert.IsTrue(result.TransferGUID == "5485364b-cac5-4c14-9638-5e7c0235a7c1"); 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); }