Beispiel #1
0
        public void FindUserByIdTest()
        {
            IDatabase database = new Database(TestUtils.ConnString);
            Assert.NotNull(database);

            UserDao userDao = new UserDao(database);
            InsertDummyData(userDao);
            Assert.Equal(items.Count, userDao.Count());

            User myUser = userDao.FindById(USER1_NAME);
            Assert.NotNull(myUser);
            Assert.Equal(USER1_NAME, myUser.Username);
            Assert.Equal(USER1_PASSWORD, myUser.Password);
            Assert.Equal(USER1_MAIL, myUser.Email);

            userDao.Delete(myUser.Username);
            Assert.Equal(3, userDao.Count());
        }
Beispiel #2
0
        public void UpdateUserTest()
        {
            IDatabase database = new Database(TestUtils.ConnString);
            Assert.NotNull(database);

            UserDao userDao = new UserDao(database);
            InsertDummyData(userDao);
            Assert.Equal(items.Count, userDao.Count());


            userDao.Update(new User(USER1_NAME, ALTER_PASSWORD, ALTER_MAIL));
            var myNewUser = userDao.FindById(USER1_NAME);
            Assert.NotNull(myNewUser);
            Assert.True(!items.Contains(myNewUser));
            Assert.Equal(USER1_NAME, myNewUser.Username);
            Assert.Equal(ALTER_PASSWORD, myNewUser.Password);
            Assert.Equal(ALTER_MAIL, myNewUser.Email);

        }