public void RegisterNewAccount_ReturnTrue() { // arrange string name = "NewName"; string email = "*****@*****.**"; string password = "******"; // act bool actual = guest.Register(name, email, password); // assert Assert.AreEqual(true, actual); }
/// <summary> /// Choose menu 'Register' /// </summary> public static void Register() { GuestLogic = new GuestLogic(); string name, email, password, input; while (true) { Console.Clear(); Print.PrintHeader("REGISTER", ConsoleColor.DarkYellow); name = Print.ReadInput("\nEnter your name (at least 3 characters): "); if (!ParseInput.IsCorrectName(name)) { Console.WriteLine("\nIncorrect name!"); input = Print.ReadInput("\n[1] Try again\nor enter any other key to return"); if (input != "1") { return; } else { continue; } } email = Print.ReadInput("\nEnter user email (*****@***): "); if (!ParseInput.IsCorrectEmail(email)) { Console.WriteLine("\nIncorrect email!"); input = Print.ReadInput("\n[1] Try again\nor enter any other key to return"); if (input != "1") { return; } else { continue; } } password = Print.ReadInput("\nEnter password (at least 3 characters): "); if (!ParseInput.IsCorrectPassword(password)) { Console.WriteLine("\nIncorrect password!"); input = Print.ReadInput("\n[1] Try again\nor enter any other key to return"); if (input != "1") { return; } else { continue; } } if (!GuestLogic.Register(name, email, password)) { Console.WriteLine("\nUser with this email already exists!"); input = Print.ReadInput("\n[1] Try again\nor enter any other key to return"); if (input != "1") { return; } } else { break; } } GuestLogic.LogIn(email, password); Console.Clear(); if (UserLogic.GetAccountType().Equals("USER")) { UserActions.UserMode(); } else { UserActions.AdminMode(); } while (true) { Print.PrintHeader($"{UserLogic.GetAccountType()}: {UserLogic.GetAccountName()}", ConsoleColor.Green); UserActions.GetActions(); input = Console.ReadLine(); Console.Clear(); Print.PrintHeader($"{UserLogic.GetAccountType()}: {UserLogic.GetAccountName()}", ConsoleColor.Green); if (input.ToLower() == "q") { UserLogic.LogOut(); break; } UserActions.ChooseAction(input); } }