Пример #1
0
        public void UserDAOConstructorTest()
        {
            /*Context*/
            AccountDAO acc_context = new AccountDAO();
            UserDAO user_context = new UserDAO();
            /*Insert*/
            AccountDTO acc = new AccountDTO();
            acc.userName = "******";
            acc.password = "******";
            acc.accountType = "administrator";
            acc.status = "active";

            acc_context.presist(acc);

            UserDTO user = new UserDTO();
            user.id = "8630302930";
            user.userName = "******";
            user.fullName = "Andre";
            user.nickName = "WIlliem";
            user.surname = "Pretorius";
            user.gender = "male";
            user.race = "white";
            user.basicEducation = true;
            user.citizenship = true;
            user.disabled = true;
            user.employed = true;
            user.employmentHistory = true;
            user.higherEducation = true;
            user.idType = "SA";
            user.language = true;
            user.license = true;
            user.postalAddress = true;
            user.residentialAddress = true;

            user_context.presist(user);
            Assert.AreEqual(true,user_context.isFound("john") );

            ///*Update*/
            user.nickName = "willi";
            user_context.merge(user);
            Assert.AreEqual(user.nickName, user_context.find("john").nickName);

            ///*Delete*/
            user_context.removeByUserId("john");
            Assert.AreEqual(user_context.isFound("john"), false);

            acc_context.removeByUserId("john");
        }