예제 #1
0
        //LAYER_Class_nameOfTheMethod_TestedScenario_ExpectedBehaviour
        public void BLL_CtrUser_insertUser_InsertUser_UserIsInserted()
        {
            //arrange
            int userId = 1;
            string userName = "******";
            string hashedPassword = "******";
            string firstName = "Adrian";
            string lastName = "Frunza";
            string email = "*****@*****.**";
            bool newsletterOptOut = false;
            DateTimeOffset createdOn = DateTimeOffset.Now;
            User user_m1 = new User(
                userId,
                userName,
                hashedPassword,
                firstName,
                lastName,
                email,
                newsletterOptOut,
                createdOn
                );
            CtrUser _CtrUser = new CtrUser();

            //act
            int result = _CtrUser.insertUser(user_m1);

            //assert
         //   Assert.AreEqual(1, result, "user not inserted");
            Assert.IsTrue(result>=(int)ENUM.CODE.TRANSLATO_DATABASE_SEED);
        }
 public ReturnedObject insertUser(string publicKey, string privateKey, User user)
 {
     ReturnedObject returnedObject = new ReturnedObject();
     if (Security.authorizeClient(publicKey, privateKey))
     {
         CtrUser _CtrUser = new CtrUser();
         returnedObject.code =  _CtrUser.insertUser(user);
     }
     else
     {
         returnedObject.code = (int)CODE.CLIENT_NOT_AUTHORIZED;
     }
     return returnedObject; 
 }