Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }