static void testJSONGoalsList(long accID) { Console.WriteLine("\n\n-------------------- Test: JSONify a List of Savings Goals--------------------"); //SavingsGoalService sgService = new SavingsGoalService(); //List<SavingsGoal> goals = sgService.getSavingsGoalsFromAccount(accID); //string json = sgService.getJSON(goals); //Console.WriteLine(json); UserAccountService uac = new UserAccountService(); Console.WriteLine(uac.getSavingsGoalsFromAccount(accID)); }
// --------------------------------------------------- Begin User Account Testing --------------------------------------------------- static void testAccCreate() { UserAccountService uaService = new UserAccountService(); PasswordService passService = new PasswordService(); Console.WriteLine("\n-------------------- Test: Getting and Creating a new User Account --------------------"); //Console.WriteLine("\n1. Testing GetAccountUsingUsername function | Prints out AccountUsername found"); //String existingAccount = uaService.getUsingUsername("AutumnNguyen").AccountUsername; //Console.WriteLine("Username: "******"\n2. Testing GetAccountUsingID function | Prints out AccountUsername found"); //String existingAccount2 = uaService.getUsingID(2).AccountUsername; //Console.WriteLine("Username: "******"\n3. Testing Password Minimum Requirements function"); //UserAccount testAccount = new UserAccount("test", "*****@*****.**", "Password1"); //uaService.write(testAccount); //Console.WriteLine(passService.checkHash("Password1", testAccount)); //Console.WriteLine("Username: "******"\n4. Testing DeleteUserAccount function | Prints out AccountUsername of deleted account"); //Console.WriteLine("Disable Username: "******"\n5. Testing CreateUserAccount function - New | Prints out AccountUsername of made account"); //UserAccount testAccount2 = new UserAccount("test2", "*****@*****.**", "password", null); //uaService.write(testAccount2); //Console.WriteLine("Username: "******"test2").AccountUsername); //Console.WriteLine("\n6. Testing UpdateUserAccount function | Prints out new AccountUsername of account"); //Console.WriteLine("Old Username: "******"test").AccountUsername); //UserAccount testAccount3 = new UserAccount(5, "testing", "*****@*****.**", "Password1"); //uaService.update(testAccount3); //Console.WriteLine("New Username: "******"testing").AccountUsername); //Console.WriteLine("\n7. Testing DeleteUserAccount function | Prints out AccountUsername of deleted account"); //Console.WriteLine("Disable Username: "******"testing").AccountUsername); //uaService.delete(5); Console.WriteLine("\n8. Password Validation"); var user = uaService.getUsingUsername("test"); Console.WriteLine("Username: "******"\nDoes the password match? " + passService.checkHash("Password1", user)); Console.WriteLine("Does the password match?: " + passService.ValidatePassword("Password1", user.PasswordSalt, user.PasswordHash)); }
public SessionService() { this.PasswordService = new PasswordService(); this.UserAccountService = new UserAccountService(); this.SessionDataAccess = new SessionDataAccess(); }