public void DeleteByGoogleIDTest()
        {
            LostTimeDB.UserAccountGateaway   userAccountGateaway   = new LostTimeDB.UserAccountGateaway(_connectionstring);
            LostTimeDB.GoogleAccountGateaway googleAccountGateaway = new LostTimeDB.GoogleAccountGateaway(_connectionstring);

            LostTimeDB.UserAccount userAccount;
            LostTimeDB.UserAccount userAccount2;

            string testUserPseudonym = "TestFindByIDPseudonymTest3";
            string testUserEmail     = "TestFindByIDEmailTest3";
            string testUserPassword  = "******";

            int    googleID    = 321;
            string googleToken = "googleTokenTest3";

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

            userAccount = userAccountGateaway.FindByName(testUserPseudonym);

            googleAccountGateaway.Create(googleID, googleToken);
            googleAccountGateaway.AssignGoogleIDToUserID(googleID, googleToken, userAccount.UserID);

            userAccount = userAccountGateaway.FindByName(testUserPseudonym);

            Assert.That(userAccount.UserGoogleID, Is.EqualTo(googleID));

            userAccountGateaway.DeleteUserAccountByGoogleID(userAccount.UserGoogleID);

            userAccount2 = userAccountGateaway.FindByGoogleID(userAccount.UserGoogleID);

            Assert.That(userAccount2, Is.Null);

            googleAccountGateaway.DeleteGoogleAccountByGoogleID(googleID);
        }
        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);
        }
        public void FindByID_DeleteByIDTest()
        {
            LostTimeDB.UserAccountGateaway userAccountGateaway = new LostTimeDB.UserAccountGateaway(_connectionstring);
            LostTimeDB.UserAccount         userAccount;
            LostTimeDB.UserAccount         userAccount2;

            string testUserPseudonym = "TestFindByIDPseudonymTest2";
            string testUserEmail     = "TestFindByIDEmailTest2";
            string testUserPassword  = "******";

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

            userAccount  = userAccountGateaway.FindByName(testUserPseudonym);
            userAccount2 = userAccountGateaway.FindByID(userAccount.UserID);
            Assert.That(userAccount.UserID, Is.EqualTo(userAccount2.UserID));
            Assert.That(userAccount.UserGoogleID, Is.EqualTo(0));
            Assert.That(userAccount.UserGoogleToken, Is.EqualTo(null));

            userAccountGateaway.DeleteUserAccountByUserID(userAccount2.UserID);
            userAccount2 = userAccountGateaway.FindByID(userAccount.UserID);
            Assert.That(userAccount2, Is.Null);
        }
Example #4
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);
        }