Exemplo n.º 1
0
        public void CreateUserTest()
        {
            IDatabase        db = DatabaseFactory.GetDatabase(Database.InMemory);
            IPasswordService passwordService = new PasswordService(db, new MasterPassword(), new RijndaelManagedEncryption());

            CreateUserResult result;
            User             user;

            user   = new User("testAccount", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            result = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.Successful, result);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            result = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.UsernameTaken, result);
        }
Exemplo n.º 2
0
        public void DeleteUserWithPasswords()
        {
            IDatabase        db = DatabaseFactory.GetDatabase(Database.InMemory);
            IPasswordService passwordService = new PasswordService(db, new MasterPassword(), new RijndaelManagedEncryption());

            User             user;
            CreateUserResult createResult;
            LoginResult      loginResult;
            DeleteUserResult deleteResult;

            // Mock a user model that would be coming from the UI
            user = new User("testAccount", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");

            createResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.Successful, createResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            loginResult = passwordService.Login("testAccount", "testPassword1@");
            Assert.AreEqual(LoginResult.Successful, loginResult);

            // Mock a password model that would be coming from the UI
            Password[] passwords =
            {
                new Password("FakeStore0", "NewUsername", "*****@*****.**", "This is my FakeStore account.", "www.FakeStore.com", "123456"),
                new Password("FakeStore1", "NewUsername", "*****@*****.**", "This is my FakeStore account.", "www.FakeStore.com", "123456"),
                new Password("FakeStore2", "NewUsername", "*****@*****.**", "This is my FakeStore account.", "www.FakeStore.com", "123456"),
                new Password("FakeStore3", "NewUsername", "*****@*****.**", "This is my FakeStore account.", "www.FakeStore.com", "123456"),
            };

            Int32 addedPasswordsCount = 1;

            foreach (var password in passwords)
            {
                AddPasswordResult result = passwordService.AddPassword(password);
                Assert.AreEqual(AddPasswordResult.Success, result);
                Assert.AreEqual(addedPasswordsCount, ((InMemoryDatabase)db).LocalPasswordDbAccess.Count);
                addedPasswordsCount++;
            }

            deleteResult = passwordService.DeleteUser(user);
            Assert.AreEqual(DeleteUserResult.Success, deleteResult);
            Assert.AreEqual(0, ((InMemoryDatabase)db).LocalPasswordDbAccess.Count);
            Assert.AreEqual(0, ((InMemoryDatabase)db).LocalUserDbAccess.Count);
        }
Exemplo n.º 3
0
        public void DeleteMultipleUsersTest()
        {
            IDatabase        db = DatabaseFactory.GetDatabase(Database.InMemory);
            IPasswordService passwordService = new PasswordService(db, new MasterPassword(), new RijndaelManagedEncryption());

            CreateUserResult createResult;
            DeleteUserResult deleteResult;

            // Mock a user model that would be coming from the UI
            User[] users =
            {
                new User("testAccount0", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**"),
                new User("testAccount1", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**"),
                new User("testAccount2", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**"),
                new User("testAccount3", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**"),
                new User("testAccount4", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**"),
            };

            Int32 addedUsersCount = 1;

            foreach (var user in users)
            {
                createResult = passwordService.CreateNewUser(user);
                Assert.AreEqual(CreateUserResult.Successful, createResult);
                Assert.AreEqual(addedUsersCount, ((InMemoryDatabase)db).LocalUserDbAccess.Count);
                addedUsersCount++;
            }

            Int32 deletedUsersCount = users.Count() - 1;

            foreach (var user in users)
            {
                deleteResult = passwordService.DeleteUser(user);
                Assert.AreEqual(DeleteUserResult.Success, deleteResult);
                Assert.AreEqual(deletedUsersCount, ((InMemoryDatabase)db).LocalUserDbAccess.Count);
                deletedUsersCount--;
            }
        }
Exemplo n.º 4
0
        public void DeleteSingleUserTest()
        {
            IDatabase        db = DatabaseFactory.GetDatabase(Database.InMemory);
            IPasswordService passwordService = new PasswordService(db, new MasterPassword(), new RijndaelManagedEncryption());

            CreateUserResult createResult;
            DeleteUserResult deleteResult;
            User             user;

            // Mock a user model that would be coming from the UI
            user = new User("testAccount", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");

            deleteResult = passwordService.DeleteUser(user);
            Assert.AreEqual(DeleteUserResult.Failed, deleteResult);

            createResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.Successful, createResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            deleteResult = passwordService.DeleteUser(user);
            Assert.AreEqual(DeleteUserResult.Success, deleteResult);
            Assert.AreEqual(0, ((InMemoryDatabase)db).LocalUserDbAccess.Count);
        }
        public void ChangeUserPasswordTest()
        {
            IDatabase        db = DatabaseFactory.GetDatabase(Database.InMemory);
            IPasswordService passwordService = new PasswordService(db, new MasterPassword(), new RijndaelManagedEncryption());

            CreateUserResult         createUserResult;
            ChangeUserPasswordResult changeUserPasswordResult;
            LoginResult  loginResult;
            LogOutResult logoutResult;
            User         user;

            user             = new User("testAccount", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.Successful, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            // Not logged in
            changeUserPasswordResult = passwordService.ChangeUserPassword("testPassword1@", "testPassword1@2", "testPassword1@2");
            Assert.AreEqual(ChangeUserPasswordResult.Failed, changeUserPasswordResult);

            loginResult = passwordService.Login("testAccount", "testPassword1@");
            Assert.AreEqual(LoginResult.Successful, loginResult);

            changeUserPasswordResult = passwordService.ChangeUserPassword("testPassword1@", "testPassword1@2", "testPassword1@2");
            Assert.AreEqual(ChangeUserPasswordResult.Success, changeUserPasswordResult);

            logoutResult = passwordService.Logout();
            Assert.AreEqual(LogOutResult.Success, logoutResult);

            loginResult = passwordService.Login("testAccount", "testPassword1@");
            Assert.AreEqual(LoginResult.PasswordIncorrect, loginResult);

            loginResult = passwordService.Login("testAccount", "testPassword1@2");
            Assert.AreEqual(LoginResult.Successful, loginResult);

            changeUserPasswordResult = passwordService.ChangeUserPassword("testPassword1@2", "1@3aA", "1@3aA");
            Assert.AreEqual(ChangeUserPasswordResult.LengthRequirementNotMet, changeUserPasswordResult);

            changeUserPasswordResult = passwordService.ChangeUserPassword("testPassword1@2", "1@3AAAAAAAAAAAAA", "1@3AAAAAAAAAAAAA");
            Assert.AreEqual(ChangeUserPasswordResult.NoLowerCaseCharacter, changeUserPasswordResult);

            changeUserPasswordResult = passwordService.ChangeUserPassword("testPassword1@2", "a@GAAAAAAAAAAAAA", "a@GAAAAAAAAAAAAA");
            Assert.AreEqual(ChangeUserPasswordResult.NoNumber, changeUserPasswordResult);

            changeUserPasswordResult = passwordService.ChangeUserPassword("testPassword1@2", "1A3aaaaaaaaaaaaa", "1A3aaaaaaaaaaaaa");
            Assert.AreEqual(ChangeUserPasswordResult.NoSpecialCharacter, changeUserPasswordResult);

            changeUserPasswordResult = passwordService.ChangeUserPassword("testPassword1@2", "1@3aaaaaaaaaaaaa", "1@3aaaaaaaaaaaaa");
            Assert.AreEqual(ChangeUserPasswordResult.NoUpperCaseCharacter, changeUserPasswordResult);

            changeUserPasswordResult = passwordService.ChangeUserPassword("testPassword1@2", "1@3aaaaaaaaaaaaa", "1@3aaaaaaaaaaaaaZ");
            Assert.AreEqual(ChangeUserPasswordResult.PasswordsDoNotMatch, changeUserPasswordResult);

            changeUserPasswordResult = passwordService.ChangeUserPassword("testPassword1@2", "", "");
            Assert.AreEqual(ChangeUserPasswordResult.Failed, changeUserPasswordResult);

            changeUserPasswordResult = passwordService.ChangeUserPassword("testPassword1@2", null, null);
            Assert.AreEqual(ChangeUserPasswordResult.Failed, changeUserPasswordResult);

            changeUserPasswordResult = passwordService.ChangeUserPassword("testPassword1@2", "testPassword1@", "testPassword1@");
            Assert.AreEqual(ChangeUserPasswordResult.Success, changeUserPasswordResult);

            changeUserPasswordResult = passwordService.ChangeUserPassword("testPassword1@", "testPassword1@2~`!@#$%^&*()_+{}[]|@\'';:.>,</?\"", "testPassword1@2~`!@#$%^&*()_+{}[]|@\'';:.>,</?\"");
            Assert.AreEqual(ChangeUserPasswordResult.Success, changeUserPasswordResult);

            logoutResult = passwordService.Logout();
            Assert.AreEqual(LogOutResult.Success, logoutResult);

            loginResult = passwordService.Login("testAccount", "testPassword1@2~`!@#$%^&*()_+{}[]|@\'';:.>,</?\"");
            Assert.AreEqual(LoginResult.Successful, loginResult);
        }
Exemplo n.º 6
0
        public void CreateUserTest()
        {
            IDatabase        db = DatabaseFactory.GetDatabase(Database.InMemory);
            IPasswordService passwordService = new PasswordService(db, new MasterPassword(), new RijndaelManagedEncryption());

            CreateUserResult      createUserResult;
            LoginResult           loginResult;
            UserInformationResult modifyUserResult;
            User user;
            User userResult;

            user             = new User("testAccount", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.Successful, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            modifyUserResult = passwordService.EditUser(new User(null, null, "testFirstName2", "testLastName2", "222-111-2222", "*****@*****.**"));
            Assert.AreEqual(UserInformationResult.Failed, modifyUserResult);

            loginResult = passwordService.Login("testAccount", "testPassword1@");
            Assert.AreEqual(LoginResult.Successful, loginResult);
            userResult = passwordService.GetCurrentUser();
            Assert.AreEqual(userResult.FirstName, "testFirstName");
            Assert.AreEqual(userResult.LastName, "testLastName");
            Assert.AreEqual(userResult.PhoneNumber, "222-111-1111");
            Assert.AreEqual(userResult.Email, "*****@*****.**");

            modifyUserResult = passwordService.EditUser(new User(null, null, "testFirstName2", "testLastName2", "222-111-2222", "*****@*****.**"));
            Assert.AreEqual(UserInformationResult.Success, modifyUserResult);

            userResult = passwordService.GetCurrentUser();
            Assert.AreEqual(userResult.FirstName, "testFirstName2");
            Assert.AreEqual(userResult.LastName, "testLastName2");
            Assert.AreEqual(userResult.PhoneNumber, "222-111-2222");
            Assert.AreEqual(userResult.Email, "*****@*****.**");

            modifyUserResult = passwordService.EditUser(new User(null, null, "", "testLastName2", "222-111-2222", "*****@*****.**"));
            Assert.AreEqual(UserInformationResult.InvalidFirstName, modifyUserResult);
            userResult = passwordService.GetCurrentUser();
            Assert.AreEqual(userResult.FirstName, "testFirstName2");
            Assert.AreEqual(userResult.LastName, "testLastName2");
            Assert.AreEqual(userResult.PhoneNumber, "222-111-2222");
            Assert.AreEqual(userResult.Email, "*****@*****.**");

            modifyUserResult = passwordService.EditUser(new User(null, null, null, "testLastName2", "222-111-2222", "*****@*****.**"));
            Assert.AreEqual(UserInformationResult.InvalidFirstName, modifyUserResult);
            userResult = passwordService.GetCurrentUser();
            Assert.AreEqual(userResult.FirstName, "testFirstName2");
            Assert.AreEqual(userResult.LastName, "testLastName2");
            Assert.AreEqual(userResult.PhoneNumber, "222-111-2222");
            Assert.AreEqual(userResult.Email, "*****@*****.**");

            modifyUserResult = passwordService.EditUser(new User(null, null, "testFirstName2", "", "222-111-2222", "*****@*****.**"));
            Assert.AreEqual(UserInformationResult.InvalidLastName, modifyUserResult);
            userResult = passwordService.GetCurrentUser();
            Assert.AreEqual(userResult.FirstName, "testFirstName2");
            Assert.AreEqual(userResult.LastName, "testLastName2");
            Assert.AreEqual(userResult.PhoneNumber, "222-111-2222");
            Assert.AreEqual(userResult.Email, "*****@*****.**");

            modifyUserResult = passwordService.EditUser(new User(null, null, "testFirstName2", null, "222-111-2222", "*****@*****.**"));
            Assert.AreEqual(UserInformationResult.InvalidLastName, modifyUserResult);
            userResult = passwordService.GetCurrentUser();
            Assert.AreEqual(userResult.FirstName, "testFirstName2");
            Assert.AreEqual(userResult.LastName, "testLastName2");
            Assert.AreEqual(userResult.PhoneNumber, "222-111-2222");
            Assert.AreEqual(userResult.Email, "*****@*****.**");

            modifyUserResult = passwordService.EditUser(new User(null, null, "testFirstName2", "testLastName2", "222-111-222", "*****@*****.**"));
            Assert.AreEqual(UserInformationResult.InvalidPhoneNumber, modifyUserResult);
            userResult = passwordService.GetCurrentUser();
            Assert.AreEqual(userResult.FirstName, "testFirstName2");
            Assert.AreEqual(userResult.LastName, "testLastName2");
            Assert.AreEqual(userResult.PhoneNumber, "222-111-2222");
            Assert.AreEqual(userResult.Email, "*****@*****.**");

            modifyUserResult = passwordService.EditUser(new User(null, null, "testFirstName2", "testLastName2", "222-111-2222", "test2test.com"));
            Assert.AreEqual(UserInformationResult.InvalidEmail, modifyUserResult);
            userResult = passwordService.GetCurrentUser();
            Assert.AreEqual(userResult.FirstName, "testFirstName2");
            Assert.AreEqual(userResult.LastName, "testLastName2");
            Assert.AreEqual(userResult.PhoneNumber, "222-111-2222");
            Assert.AreEqual(userResult.Email, "*****@*****.**");
        }
Exemplo n.º 7
0
        public void CreateUserValidationTest()
        {
            IDatabase        db = DatabaseFactory.GetDatabase(Database.InMemory);
            IPasswordService passwordService = new PasswordService(db, new MasterPassword(), new RijndaelManagedEncryption());

            CreateUserResult createUserResult;
            User             user;

            // Test success
            user             = new User("testAccount", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.Successful, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            // Test user names
            user             = new User("testAccount", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.UsernameTaken, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.UsernameNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User(null, "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.UsernameNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            // Test passwords
            user             = new User("testAccount1", "testPassword1", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.NoSpecialCharacter, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", "aaaaaaaaaaaaaa!1", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.NoUpperCaseCharacter, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", "AAAAAAAAAAAAA!a", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.NoNumber, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", "AAAAAAAAAAAAA!1", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.NoLowerCaseCharacter, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", "1A@a", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.LengthRequirementNotMet, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", "", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.PasswordNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", null, "testFirstName", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.PasswordNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            // Test first names
            user             = new User("testAccount1", "testPassword1@", "", "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.FirstNameNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", "testPassword1@", null, "testLastName", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.FirstNameNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            // Test last names
            user             = new User("testAccount1", "testPassword1@", "testFirstName", "", "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.LastNameNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", "testPassword1@", "testFirstName", null, "222-111-1111", "*****@*****.**");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.LastNameNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            // Test email
            user             = new User("testAccount1", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "test@testcom");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.EmailNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "testtest.com");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.EmailNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", "testPassword1@", "testFirstName", "testLastName", "222-111-1111", "testtestcom");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.EmailNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            // Test phone number
            user             = new User("testAccount1", "testPassword1@", "testFirstName", "testLastName", "5555555555555555555", "test@testcom");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.PhoneNumberNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", "testPassword1@", "testFirstName", "testLastName", "sgsdfgsdfgfdsg", "test@testcom");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.PhoneNumberNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", "testPassword1@", "testFirstName", "testLastName", "#$%^#$^#$^%$#^@@#$", "test@testcom");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.PhoneNumberNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            user             = new User("testAccount1", "testPassword1@", "testFirstName", "testLastName", "g-222-111-1111", "test@testcom");
            createUserResult = passwordService.CreateNewUser(user);
            Assert.AreEqual(CreateUserResult.PhoneNumberNotValid, createUserResult);
            Assert.AreEqual(1, ((InMemoryDatabase)db).LocalUserDbAccess.Count);
        }
Exemplo n.º 8
0
        public void DeleteUserWithMultiplePasswords()
        {
            IDatabase        db = DatabaseFactory.GetDatabase(Database.InMemory);
            IPasswordService passwordService = new PasswordService(db, new MasterPassword(), new RijndaelManagedEncryption());

            CreateUserResult createResult;
            LoginResult      loginResult;
            DeleteUserResult deleteResult;
            LogOutResult     logOutResult;

            // Mock a user model that would be coming from the UI
            User[] users =
            {
                new User("testAccount0", "testPassword1@1", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**"),
                new User("testAccount1", "testPassword1@2", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**"),
                new User("testAccount2", "testPassword1@3", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**"),
                new User("testAccount3", "testPassword1@4", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**"),
                new User("testAccount4", "testPassword1@5", "testFirstName", "testLastName", "222-111-1111", "*****@*****.**"),
            };

            // Mock a password model that would be coming from the UI
            Password[] passwords =
            {
                new Password("FakeStore0", "NewUsername", "*****@*****.**", "This is my FakeStore account.", "www.FakeStore.com", "123456"),
                new Password("FakeStore1", "NewUsername", "*****@*****.**", "This is my FakeStore account.", "www.FakeStore.com", "123456"),
                new Password("FakeStore2", "NewUsername", "*****@*****.**", "This is my FakeStore account.", "www.FakeStore.com", "123456"),
                new Password("FakeStore3", "NewUsername", "*****@*****.**", "This is my FakeStore account.", "www.FakeStore.com", "123456"),
            };

            // Add each user to the database, log in, add each password to each user, logout
            Int32 addedUsersCount     = 1;
            Int32 addedPasswordsCount = 1;

            foreach (var user in users)
            {
                createResult = passwordService.CreateNewUser(user);
                Assert.AreEqual(CreateUserResult.Successful, createResult);
                Assert.AreEqual(addedUsersCount, ((InMemoryDatabase)db).LocalUserDbAccess.Count);
                addedUsersCount++;

                loginResult = passwordService.Login(user.Username, user.PlainTextPassword);
                Assert.AreEqual(LoginResult.Successful, loginResult);

                foreach (var password in passwords)
                {
                    AddPasswordResult result = passwordService.AddPassword(password);
                    Assert.AreEqual(AddPasswordResult.Success, result);
                    Assert.AreEqual(addedPasswordsCount, ((InMemoryDatabase)db).LocalPasswordDbAccess.Count);
                    addedPasswordsCount++;
                }

                logOutResult = passwordService.Logout();
                Assert.AreEqual(LogOutResult.Success, logOutResult);
            }

            // Login to the account to delete
            loginResult = passwordService.Login("testAccount0", "testPassword1@1");
            Assert.AreEqual(LoginResult.Successful, loginResult);

            // Delete the account
            string currentUserGUID = passwordService.GetCurrentUser().GUID;

            deleteResult = passwordService.DeleteUser(passwordService.GetCurrentUser());
            Assert.AreEqual(DeleteUserResult.Success, deleteResult);
            Assert.AreEqual(((passwords.Length * users.Length) - passwords.Length), ((InMemoryDatabase)db).LocalPasswordDbAccess.Count);
            Assert.AreEqual((users.Length - 1), ((InMemoryDatabase)db).LocalUserDbAccess.Count);

            // Verify that the deleted account's passwords are deleted from the password database table
            foreach (var password in ((InMemoryDatabase)db).LocalPasswordDbAccess)
            {
                if (password.UserGUID == currentUserGUID)
                {
                    Assert.Fail();
                }
            }
        }