public void GetAccountsForInvalidUser() { AccountManagement accManage = new AccountManagement(); var accounts = accManage.GetAccounts(new User()); if (accounts.Count() > 0) Assert.Fail("Accounts returned for invalid user."); }
public void GetAccountsForValidUser() { AccountManagement accManage = new AccountManagement(); UserManagement userManage = new UserManagement(); User user = userManage.Login(new User{ Email = "*****@*****.**", Password = "******"}); var accounts = accManage.GetAccounts(user); if (accounts.Count() < 1) Assert.Fail("No accounts returned for valid user."); }
public void CreateInvalidAccount() { UserManagement userManagement = new UserManagement(); User user = userManagement.Login(new User { Email = "*****@*****.**", Password = "******" }); if (user == null) Assert.Fail("No user for new account."); Account newAccount = new Account(); AccountManagement accountManagement = new AccountManagement(); accountManagement.CreateAccount(newAccount); }
public void CreateAccount(Account account) { try { AccountManagement accountManagement = new AccountManagement(); accountManagement.CreateAccount(account); } catch (ModelException ex) { CapitalError error = new CapitalError(ex); throw new FaultException<CapitalError>(error, error.Message); } catch (Exception) { return; } }
public IEnumerable<Account> GetAccounts(User source) { try { AccountManagement accountManagement = new AccountManagement(); return accountManagement.GetAccounts(source); } catch (ModelException ex) { CapitalError error = new CapitalError(ex); throw new FaultException<CapitalError>(error, error.Message); } catch (Exception) { return null; } }
public void UpdateValidAccount() { UserManagement userManage = new UserManagement(); User user = userManage.Login(new User { Email = "*****@*****.**", Password = "******" }); AccountManagement accManage = new AccountManagement(); Account[] accounts = accManage.GetAccounts(user).ToArray(); if (accounts == null || accounts.Count() < 1) Assert.Fail("No account to update."); Account target = accounts[0]; target.AccountName = "New Account Name"; target.Balance = 1000000; target.DefaultPayment = 50; accManage.UpdateAccount(target); }
public void CreateValidAccount() { UserManagement userManagement = new UserManagement(); User user = userManagement.Login(new User { Email = "*****@*****.**", Password = "******" }); if (user == null) Assert.Fail("No user for new account."); Account newAccount = new Account(); newAccount.AccountName = "TEST 1"; newAccount.CreationDate = DateTime.Now; newAccount.StartDate = DateTime.Now; newAccount.DefaultPayment = 200.00; newAccount.FrequencyId = 2; newAccount.UserId = user.UserId; newAccount.AccountTypeId = 1; AccountManagement accountManagement = new AccountManagement(); accountManagement.CreateAccount(newAccount); }
public void GetStatementsCreateSecondStatement() { UserManagement userManage = new UserManagement(); User user = userManage.Login(new User { Email = "*****@*****.**", Password = "******" }); AccountManagement accManage = new AccountManagement(); Statement[] statements = accManage.GetStatements(user).ToArray(); if (statements.Count() == 0) Assert.Fail("No Statement was created."); }
public void UpdateStatement() { UserManagement userManage = new UserManagement(); User user = userManage.Login(new User { Email = "*****@*****.**", Password = "******" }); AccountManagement accManage = new AccountManagement(); Statement[] statements = accManage.GetStatements(user).ToArray(); Statement statement = statements[0]; statement.IsPaid = true; accManage.UpdateStatement(statement); }
public void ShareValidAccount() { UserManagement userManage = new UserManagement(); AccountManagement accManage = new AccountManagement(); // Owner User Owner = userManage.CreateUser(new User { Email = "*****@*****.**", Password = "******", CreationDate = DateTime.Now, LastAccessDate = DateTime.Now }); // Owner Account accManage.CreateAccount(new Account { AccountName = "ShareAccountTest", CreationDate = DateTime.Now, StartDate = DateTime.Now, FrequencyId = 3, AccountTypeId = 1, UserId = Owner.UserId }); Account[] accounts = accManage.GetAccounts(Owner).ToArray(); // Share user User shareUser = userManage.CreateUser(new User { Email = "*****@*****.**", Password = "******", CreationDate = DateTime.Now, LastAccessDate = DateTime.Now }); // Share int accountID = accounts[0].AccountId; Share share = new Share(); share.UserId = shareUser.UserId; share.AccountId = accounts[0].AccountId; share.PermissionLevelId = 2; accManage.ShareAccount(share); // Confirm accounts = accManage.GetAccounts(shareUser).ToArray(); Account account = accounts.FirstOrDefault(x => x.AccountId == accountID); if (account == null) Assert.Fail("Shared account was not in Shared User collection."); if (!(account.IsShare)) Assert.Fail("Shared account is not flagged as shared."); if (account.PermissionLevel < 1) Assert.Fail("Shared account permission level is invalid."); }
public void DeleteInvalidAccount() { AccountManagement accManage = new AccountManagement(); accManage.DeleteAccount(new Account { AccountId = 0 }); }
public void DeleteValidAccount() { UserManagement userManage = new UserManagement(); User user = userManage.Login(new User { Email = "*****@*****.**", Password = "******" }); AccountManagement accManage = new AccountManagement(); Account[] accounts = accManage.GetAccounts(user).ToArray(); if (accounts == null || accounts.Count() < 1) Assert.Fail("No account to delete."); accManage.DeleteAccount(accounts[0]); }
public Statement GetStatementById(User user, int id) { try { AccountManagement accountManagement = new AccountManagement(); return accountManagement.GetStatementById(user, id); } catch (ModelException ex) { CapitalError error = new CapitalError(ex); throw new FaultException<CapitalError>(error, error.Message); } catch (Exception) { return null; } }