예제 #1
0
        public void Update_GivenOneStudentInFile_ShouldReturnAStudentWithDiferentNameAndAge()
        {
            var json = "[{ \"Id\":\"1\", \"Name\":\"Pepe\", \"LastName\":\"Perez\", \"Age\": 20}]";

            File.WriteAllText(FileName, json);
            var student = new Student
            {
                Id       = 1,
                Name     = "Max",
                LastName = "Perez",
                Age      = 21
            };
            var jsonStudentDao = new JsonStudentDao();
            var updateStudent  = jsonStudentDao.Update(student);

            jsonStudentDao.GetAll();
            Assert.AreEqual(updateStudent.Name, student.Name);
            Assert.AreEqual(updateStudent.LastName, student.LastName);
            Assert.AreEqual(updateStudent.Age, student.Age);
        }