public void Create_Update_Delete_UserAccount()
        {
            LostTimeDB.UserAccountGateaway userAccountGateaway = new LostTimeDB.UserAccountGateaway(_connectionstring);
            LostTimeDB.UserAccount         userAccount;
            LostTimeDB.UserAccount         userAccount2;

            string testUserPseudonym = "TestUserPseudonymTest1";
            string testUserEmail     = "TestUserEmailTest1";
            string testUserPassword  = "******";


            string TestUserUpdatePseudonym = "TestUserUpdatePseudonymTest1";
            string TestUserUpdateEmail     = "TestUserUpdateEmailTest1";
            string TestUserUpdatePassword  = "******";

            userAccountGateaway.CreateNewUserAccount(testUserPseudonym, testUserEmail, testUserPassword, DateTime.Now);

            userAccount = userAccountGateaway.FindByName(testUserPseudonym);
            CheckUserAccount(userAccount, userAccount.UserID, testUserPseudonym, testUserEmail, testUserPassword, userAccount.UserAccountCreationDate);

            userAccountGateaway.UpdateUserAccount(userAccount.UserID, TestUserUpdatePseudonym, TestUserUpdateEmail, TestUserUpdatePassword);
            userAccount2 = userAccountGateaway.FindByName(TestUserUpdatePseudonym);
            CheckUserAccount(userAccount2, userAccount2.UserID, TestUserUpdatePseudonym, TestUserUpdateEmail, TestUserUpdatePassword, userAccount2.UserAccountCreationDate);

            userAccountGateaway.DeleteUserAccountByName(TestUserUpdatePseudonym);
            userAccount = userAccountGateaway.FindByName(TestUserUpdatePseudonym);
            Assert.That(userAccount, Is.Null);
        }
Exemple #2
0
        public void Create_Assign_FindByGoogleAccount()
        {
            LostTimeDB.GoogleAccountGateaway googleAccountGateaway = new LostTimeDB.GoogleAccountGateaway(_connectionstring);
            LostTimeDB.UserAccountGateaway   userAccountGateaway   = new LostTimeDB.UserAccountGateaway(_connectionstring);
            LostTimeDB.UserAccount           userAccount;
            LostTimeDB.UserAccount           userAccount2;
            LostTimeDB.UserAccount           userAccount3;

            string Pseudo = "PseudoTest";
            string Email  = "*****@*****.**";
            string Mdp    = "MdpTest";

            int    GoogleID    = 123;
            string GoogleToken = "googleTokenTest";


            userAccountGateaway.CreateNewUserAccount(Pseudo, Email, Mdp, DateTime.Now);

            userAccount = userAccountGateaway.FindByName(Pseudo);

            Assert.That(userAccount.UserPseudonym, Is.EqualTo(Pseudo));

            googleAccountGateaway.Create(GoogleID, GoogleToken);
            googleAccountGateaway.AssignGoogleIDToUserID(GoogleID, GoogleToken, userAccount.UserID);

            userAccount2 = userAccountGateaway.FindByName(Pseudo);

            Assert.That(userAccount2.UserGoogleID, Is.EqualTo(GoogleID));
            Assert.That(userAccount2.UserGoogleToken, Is.EqualTo(GoogleToken));

            userAccount3 = userAccountGateaway.FindByGoogleID(GoogleID);

            Assert.That(userAccount3.UserGoogleID, Is.EqualTo(GoogleID));
            Assert.That(userAccount3.UserGoogleToken, Is.EqualTo(GoogleToken));

            userAccountGateaway.DeleteUserAccountByName(Pseudo);
            googleAccountGateaway.DeleteGoogleAccountByGoogleID(GoogleID);
        }