예제 #1
0
파일: TestSuite3.cs 프로젝트: ltj/rentit
        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();
        }
예제 #2
0
파일: TestSuite4.cs 프로젝트: ltj/rentit
        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();
        }