// Prompts the user from stdin to create a new account private static void CreateAccount(Services.BankLedger ledger) { Console.WriteLine(); Console.WriteLine($"Enter your desired username (or \"{EXIT_KEYWORD}\" to return to the main menu):"); var username = Console.ReadLine(); // verifying account doesn't already exist with given username while (!username.Equals(EXIT_KEYWORD, StringComparison.OrdinalIgnoreCase) && ledger.UserExists(username)) { Console.WriteLine($"Username {username} is already taken. Please enter a different username:"******"Enter your desired password:"******"Re-enter your password:"******"The passwords you entered did not match. Please try again."); Console.WriteLine("Enter your desired password:"******"Re-enter your password:"******"Account successfully created! Please log in."); Console.WriteLine(); } }
public void TestLogIn() { ledger.CreateAccount("testUsername", "testPassword"); Assert.IsTrue(ledger.LogIn("testUsername", "testPassword")); Assert.AreEqual("testUsername", ledger.GetCurrentUser()); Assert.IsTrue(ledger.IsLoggedIn()); }