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);
        }
示例#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);
        }