Esempio n. 1
0
        public void CleanupCreateUser(string name)
        {
            var db = new RentItTestDatabase.RentItDatabaseDataContext();

            RentItTestDatabase.User_account userResult = (from ua in db.User_accounts
                                                          where ua.user_name.Equals(name)
                                                          select ua).First();
            db.User_accounts.DeleteOnSubmit(userResult);

            // delete user created by CreateNewUserTest()
            RentItTestDatabase.Account acctResult = (from user in db.Accounts
                                                     where user.user_name.Equals(name)
                                                     select user).First();

            db.Accounts.DeleteOnSubmit(acctResult);

            db.SubmitChanges();
        }
Esempio n. 2
0
        public void DeleteMediaTest1()
        {
            RentItClient target = new RentItClient();
            int mediaId = 3; // Kraftwerk - The Robots
            AccountCredentials credentials = new AccountCredentials {
                UserName = "******",
                HashedPassword = "******"
            };
            bool expected = true;
            bool actual = target.DeleteMedia(mediaId, credentials);
            Assert.AreEqual(expected, actual);

            var db = new RentItTestDatabase.RentItDatabaseDataContext();

            // clean up
            var deletedMedia = (from m in db.Medias
                                where m.id == mediaId
                                select m).Single();
            deletedMedia.active = true;
            db.SubmitChanges();
        }
Esempio n. 3
0
        public void DeleteAccountTest()
        {
            var db = new RentItTestDatabase.RentItDatabaseDataContext();
            RentItClient target = new RentItClient();

            Account delAccount = new Account {
                UserName = "******",
                FullName = "Unit Testesen1",
                Email = "*****@*****.**",
                HashedPassword = "******"
            };
            target.CreateNewUser(delAccount);

            AccountCredentials credentials = new AccountCredentials {
                UserName = "******",
                HashedPassword = "******"
            };
            bool expected = true;
            bool actual;
            actual = target.DeleteAccount(credentials);
            Assert.AreEqual(expected, actual);

            CleanupCreateUser(credentials.UserName);
        }