public void AddNewAccountTest() { Account newAccount = new Account(21, 300, new DateTime(2013, 04, 01), new List <Donation>() { new Donation(201, "reason:101", 12.5, DateTime.Today, ""), new Donation(202, "reason:102", 12.5, DateTime.Today, ""), new Donation(203, "reason:103", 12.5, DateTime.Today, ""), new Donation(204, "reason:104", 12.5, DateTime.Today, ""), new Donation(205, "reason:105", 12.5, DateTime.Today, ""), new PaidDonation(206, "reason:106", 12.5, DateTime.Today, "", DateTime.Today), new PaidDonation(207, "reason:107", 12.5, DateTime.Today, "", DateTime.Today), new PaidDonation(208, "reason:108", 12.5, DateTime.Today, "", DateTime.Today), new PaidDonation(209, "reason:109", 12.5, DateTime.Today, "", DateTime.Today), new PaidDonation(210, "reason:110", 12.5, DateTime.Today, "", DateTime.Today) }); int personId = 1; Enums.CRUDResults expected = Enums.CRUDResults.CREATE_SUCCESS; Enums.CRUDResults actual; actual = AccountAccess.AddNewAccount(newAccount, personId); Assert.AreEqual(expected, actual); Account addedAccount = AccountAccess.GetAccountById(21); Assert.AreEqual(newAccount, addedAccount); }
public void UpdateSingleNonExsistentAccountTest() { Account updatedAccount = new Account(50, 43, DateTime.Today, new List <Donation>()); int personId = 1; Enums.CRUDResults expected = Enums.CRUDResults.UPDATE_FAIL; Enums.CRUDResults actual; actual = AccountAccess.UpdateSingleAccount(updatedAccount, personId); Assert.AreEqual(expected, actual); }
public void DeleteSingleNonexstintAccountTest() { Account deletedAccount = new Account(50, 250, DateTime.Today, new List <Donation>()); int personId = 1; Enums.CRUDResults expected = Enums.CRUDResults.DELETE_FAIL; Enums.CRUDResults actual; actual = AccountAccess.DeleteSingleAccount(deletedAccount, personId); Assert.AreEqual(expected, actual); }
public void UpsertUpdateSingleAccountTest() { Account upsertedAccount = new Account(7, 613, DateTime.MinValue, new List <Donation>()); int personId = 1; Enums.CRUDResults expected = Enums.CRUDResults.UPDATE_SUCCESS; Enums.CRUDResults actual; actual = AccountAccess.UpsertSingleAccount(upsertedAccount, personId); Assert.AreEqual(expected, actual); Account afterUpsert = AccountAccess.GetAccountById(7); Assert.AreEqual(upsertedAccount, afterUpsert); }
public void UpsertAddSingleAccountTest() { Account upsertedAccount = new Account(613, 9857, DateTime.Today, new List <Donation>()); int personId = 1; Enums.CRUDResults expected = Enums.CRUDResults.CREATE_SUCCESS; Enums.CRUDResults actual; actual = AccountAccess.UpsertSingleAccount(upsertedAccount, personId); Assert.AreEqual(expected, actual); Account afterUpsert = AccountAccess.GetAccountById(613); Assert.AreEqual(upsertedAccount, afterUpsert); }
public void DeleteSingleAccountTest() { Account deletedAccount = new Account(2, 0, DateTime.Today, new List <Donation>()); int personId = 1; Enums.CRUDResults expected = Enums.CRUDResults.DELETE_SUCCESS; Enums.CRUDResults actual; actual = AccountAccess.DeleteSingleAccount(deletedAccount, personId); Assert.AreEqual(expected, actual); List <Account> allCurrentAccounts = AccountAccess.GetAllAccounts(); Assert.IsFalse(allCurrentAccounts.Contains(deletedAccount)); }
public void UpdateSingleAccountAfterChangingDonationsTest() { Account updatedAccount = AccountAccess.GetAccountById(8); updatedAccount.UnpaidDonations.Add(new Donation(900, "reason:900", 12.6, DateTime.Today, "")); int personId = 1; Enums.CRUDResults expected = Enums.CRUDResults.UPDATE_SUCCESS; Enums.CRUDResults actual; actual = AccountAccess.UpdateSingleAccount(updatedAccount, personId); Assert.AreEqual(expected, actual); Account afterUpdate = AccountAccess.GetAccountById(8); Assert.AreEqual(updatedAccount, afterUpdate); }