예제 #1
0
        public void TxtAddTest(int id, string name, string surname, int edad, string dni, string datebirth)
        {
            log.Info(System.Reflection.MethodBase.GetCurrentMethod().Name + " iniciado");

            Student student = new Student(id, name, surname, edad, dni, datebirth);

            AbstarctFactory formatfactory = new FormatFactory();
            IStudentDao     stddao        = formatfactory.CreateStudentFormat("txt");

            Student studenttest = stddao.Add(student);

            studenttest.FechaNacimiento = student.FechaNacimiento;

            log.Info("studenttest G: " + studenttest.Student_Guid + ", stuednt G:" + student.Student_Guid);

            log.Info("studenttest: " + studenttest.FechaNacimiento + ", stuednt:" + student.FechaNacimiento);
            log.Info("studenttest: " + studenttest.Nombre + ", stuednt:" + student.Nombre);
            log.Info("studenttest: " + studenttest.Edad + ", stuednt:" + student.Edad);
            log.Info("studenttest: " + studenttest.HoraRegistro + ", stuednt:" + student.HoraRegistro);
            log.Info("studenttest: " + studenttest.IdAlumno + ", stuednt:" + student.IdAlumno);
            log.Info("studenttest: " + studenttest.Apellido + ", stuednt:" + student.Apellido);
            log.Info("studenttest: " + studenttest.SavedFormat + ", stuednt:" + student.SavedFormat);
            log.Info("studenttest: " + studenttest.Dni + ", stuednt:" + student.Dni);

            Assert.IsTrue(student.Equals(studenttest));

            log.Info(System.Reflection.MethodBase.GetCurrentMethod().Name + " terminado");
        }
예제 #2
0
 public Alumno Add(Alumno student, TypeFormat typeFormat)
 {
     try
     {
         student.DateRegistry = DateTime.Now;
         Log.Debug("Fecha actual calculada");
         student.Edad = Age.AreAge(student.DateBorn, student.DateRegistry);
         IStudentDao  = ChangeFormat(typeFormat);
         Log.Debug("Formato pasado la capa Dao");
         return(IStudentDao.Add(student));
     }
     catch (ArgumentNullException e)
     {
         Log.Error("Falta una instancia" + e);
         throw;
     }
     catch (FileNotFoundException) { throw; }
     catch (FileLoadException)
     {
         throw;
     }
     catch (FormatException)
     {
         throw;
     }
 }
예제 #3
0
 public void AddTest(EnumType type)
 {
     Assert.AreEqual(studentDao.Add(student, type), student);
     //Assert.IsTrue(studentDao.Add(student, type).StudentId == student.StudentId);
 }