public void SearchXmlById(int idStudent, Common.Models.EnumTypeFactory typeFactory, String id, String name, String surname, String DateOfBirth) { student.StudentId = Int32.Parse(id); student.Name = name; student.Surname = surname; student.DateOfBirth = DateTime.Parse(DateOfBirth).Date; IAbstractFileFactory fileFactory = utils.DetectFactory(typeFactory); var file = fileFactory.CreateFile(); readStudent = file.ReturnStringStudentById(idStudent); Assert.IsTrue(student.Equals(readStudent)); }
/// <summary> /// Adds a student information to a file /// </summary> /// <param name="student"></param> /// <returns></returns> public Student Add(Student student, Common.Models.EnumTypeFactory enumType) { bool FileExistsInDirectory; Utils utilsFactory = new Utils(); IAbstractFileFactory fileFactory = utilsFactory.DetectFactory(enumType); var file = fileFactory.CreateFile(); //Separar en clases FileExistsInDirectory = file.CheckFileExists(); if (FileExistsInDirectory == false) { file.CreateFile(); } file.WriteToFile(student); return(student); }