public void GetAll_GivenNonExistentFile_ShouldReturnAnEmptyList() { if (File.Exists(FileName)) { File.Delete(FileName); } var xmlStudentDao = new XmlStudentDao(); var list = xmlStudentDao.GetAll(); Assert.AreEqual(0, list.Count); }
public void Delete_GivenOneStudentInFile_ShouldReturnAnEmptyList() { var student = new Student { Id = 1 }; var xmlStudentDao = new XmlStudentDao(); xmlStudentDao.Delete(student); var list = xmlStudentDao.GetAll(); Assert.AreEqual(3, list.Count); }
public void Update_GivenFourStudentsInFile_ShouldReturnAListWithSixElement() { var student = new Student { Id = 1 }; var xmlStudentDao = new XmlStudentDao(); xmlStudentDao.Update(student); var list = xmlStudentDao.GetAll(); Assert.AreEqual(4, list.Count); }
public void Create_GivenAFourStudentsInFile_ShouldReturnAListWithFiveElement() { var student = new Student { Id = 5, Name = "Pepe", LastName = "Perez", Age = 21 }; var xmlStudentDao = new XmlStudentDao(); xmlStudentDao.Create(student); var list = xmlStudentDao.GetAll(); Assert.AreEqual(5, list.Count); }