예제 #1
0
 public void CheckEmailtest()
 {
     DbCheckEmailExists emailCheck = new DbCheckEmailExists();
     //should return true
     Assert.IsTrue(emailCheck.checkEmailExists("*****@*****.**"));
     //to pass the test false is changed to true
     Assert.IsTrue(!emailCheck.checkEmailExists("*****@*****.**"));
 }
예제 #2
0
        public int CalculateProfileScore(int id)
        {
            ServerDatabase.DbStudent dbStudentObj = new ServerDatabase.DbStudent();
            ServerDatabase.DbCheckEmailExists dbCheckEmailObj = new ServerDatabase.DbCheckEmailExists();
            object[] queueBasedArray = new object[3];

            dbStudentObj.GetQueueBasedData(id).CopyTo(queueBasedArray);
            //update score to the table and return it ONLY if update was successfult
            return dbStudentObj.UpdateScore(id, CalculateProfileScoreResult(queueBasedArray));
        }
예제 #3
0
        public bool AddStudent(string email, string password, bool confirmed, bool student,
            int score, int numberOfChildren, bool pet, int numberOfCohabiters, bool disabled, DateTime dateOfCreation,
            string name, string surname, string address, string postCode, string city, string country, string phone)
        {
            ServerModel.MdlStudent mdlStudentObj = new ServerModel.MdlStudent(0, email, password, confirmed, student,
                score, numberOfChildren, pet, numberOfCohabiters, disabled, dateOfCreation, name, surname, address, postCode, city, country, phone);

            ServerDatabase.DbStudent dbStudentObj = new ServerDatabase.DbStudent();
            ServerDatabase.DbCheckEmailExists dbCheckEmailObj = new ServerDatabase.DbCheckEmailExists();

            if (!dbCheckEmailObj.checkEmailExists(mdlStudentObj.Email))
                return dbStudentObj.AddStudent(mdlStudentObj);

            Console.WriteLine("Registration has failed due to the existing email");
            Console.WriteLine("Thread: " + Thread.CurrentThread.ManagedThreadId.ToString() + " Time: " + DateTime.Now.ToString());
            return false;
        }