Beispiel #1
0
        public void FindByIdTest(int studentId)
        {
            daoFactory    = new StudentDAOFactory();
            studentDaoTxt = daoFactory.CreateStudentDAOTxt();
            Student found = studentDaoTxt.FindById(studentId);

            Assert.IsNotNull(found);
        }
Beispiel #2
0
        private void BtnUpdate(IAbstractStudentDAO dao)
        {
            Student student = CreateStudentFromFields();

            dao.Update(student.StudentId, student);
            //TODO: Check if the save operation is OK, otherwise show error and keep form data.
            ClearFormFields();
            ShowPopUp("Estudiante actualizado");
        }
        public void AddTest(int id, string name, string surname, string day, string month, string year)
        {
            daoFactory     = new StudentDAOFactory();
            studentDaoJson = daoFactory.CreateStudentDAOJson();
            string  dateString      = day + "/" + month + "/" + year;
            Student student         = new Student(id, name, surname, DateUtilities.StringToDateTimeES(dateString));
            Student insertedStudent = studentDaoJson.Add(student);

            Assert.IsTrue(student.Equals(insertedStudent));
        }
Beispiel #4
0
        public void AddTest(int id, string name, string surname, string day, string month, string year)
        {
            daoFactory    = new StudentDAOFactory();
            studentDaoTxt = daoFactory.CreateStudentDAOTxt();
            string dateString = day + "/" + month + "/" + year;

            //We can use Convert.ToDateTime(dateString) instead of the utility method StringToDateTimeES(dateString)
            Student student         = new Student(id, name, surname, DateUtilities.StringToDateTimeES(dateString));
            Student insertedStudent = studentDaoTxt.Add(student);

            //We can use Assert.AreEqual(student, insertedStudent)
            Assert.IsTrue(student.Equals(insertedStudent));
        }
Beispiel #5
0
        private void BtnFind(IAbstractStudentDAO dao)
        {
            int     studentId    = Int32.Parse(txtStudentId.Text);
            Student foundStudent = dao.FindById(studentId);

            if (foundStudent != null)
            {
                txtStudentId.Text   = foundStudent.StudentId.ToString();
                txtName.Text        = foundStudent.Name;
                txtSurname.Text     = foundStudent.Surname;
                txtDateOfBirth.Text = DateUtilities.DateTimeToStringES(foundStudent.DateOfBirth);
            }
        }
Beispiel #6
0
 private void InitializeStudentDAOs()
 {
     studentDAOTxt  = studentDAOFactory.CreateStudentDAOTxt();
     studentDAOXml  = studentDAOFactory.CreateStudentDAOXml();
     studentDAOJson = studentDAOFactory.CreateStudentDAOJson();
 }