public void Data_Read_Transaction() { var repository = new TransactionRepository(_dataConnectionString, 1); var data = repository.Get(1); Assert.IsTrue(data.TransactionID == 1); Assert.IsTrue(data.Category_CategoryID == 1); Assert.IsTrue(data.CategoryName == "Salary"); Assert.IsTrue(data.Description == "USER1CURRENT1"); }
public void Data_Delete_Transaction() { var repository = new TransactionRepository(_dataConnectionString, 1); var result = repository.Delete(1); var transaction = repository.Get(1); Assert.IsTrue(transaction == null); Assert.IsTrue(result.Deleted == true); Assert.IsTrue(result.DeletedBy == 1); Assert.IsTrue(result.DeletedDate.Value.Date == DateTime.Now.Date); }
public void Data_Read_Other_User_Transaction() { var repository = new TransactionRepository(_dataConnectionString, 1); var data = repository.Get(21); Assert.IsTrue(data == null); }
public void Data_Update_Transaction() { var repository = new TransactionRepository(_dataConnectionString, 1); var transaction = repository.Get(1); transaction.Account_AccountID = 3; transaction.Category_CategoryID = 6; transaction.Description = "UPDATED"; transaction.Amount = -30.00M; transaction.Date = new DateTime(2015, 1, 11, 11, 40, 30, 0); transaction.Note = "MOVEDTOCREDIT"; transaction.TransferGUID = "5485364b-cac5-4c14-9638-5e7c0235a7c1"; var result = repository.Update(transaction); Assert.IsTrue(result.TransactionID == 1); Assert.IsTrue(result.Account_AccountID == 3); Assert.IsTrue(result.AccountName == "Credit"); Assert.IsTrue(result.Category_CategoryID == 6); Assert.IsTrue(result.CategoryName == "Payments"); Assert.IsTrue(result.Description == "UPDATED"); Assert.IsTrue(result.Amount == -30.00M); Assert.IsTrue(result.Date == new DateTime(2015, 1, 11, 11, 40, 30, 0)); Assert.IsTrue(result.Note == "MOVEDTOCREDIT"); Assert.IsTrue(result.TransferGUID == "5485364b-cac5-4c14-9638-5e7c0235a7c1"); Assert.IsTrue(result.LastModifiedBy == 1); Assert.IsTrue(result.LastModifiedDate.Date == DateTime.Now.Date); }