public void UpdateStudentFredDoesNotExist()
        {
            //  Arrange;
            var db = new StudentRegistrationApp.Model.StudentRepository();

            var student = new StudentRegistrationApp.Model.Student()
            {
                Firstname   = "Fred",
                Surname     = "Harrison",
                DOB         = new DateTime(1960, 2, 1),
                YearOfStudy = StudentRegistrationApp.Model.YearOfStudyEnum.Third
            };

            //  Act:
            db.UpdateStudent(student);

            //  Assert: Tim is now in Third Year of Study
            var results = db.GetStudents();

            Assert.AreEqual(results.Count(), 2);
            Assert.AreEqual(results[0].Firstname, "Tim");
            Assert.AreEqual(results[0].YearOfStudy, StudentRegistrationApp.Model.YearOfStudyEnum.Second);
            Assert.AreEqual(results[1].Firstname, "Nancy");
            Assert.AreEqual(results[1].YearOfStudy, StudentRegistrationApp.Model.YearOfStudyEnum.First);
        }
        public void UpdateStudentTimNameChangeWhichShouldFail()
        {
            //  Arrange;
            var db = new StudentRegistrationApp.Model.StudentRepository();

            var student = new StudentRegistrationApp.Model.Student()
            {
                Firstname   = "Tim Peter",
                Surname     = "Harrison",
                DOB         = new DateTime(1960, 2, 1),
                YearOfStudy = StudentRegistrationApp.Model.YearOfStudyEnum.Third
            };

            //  Act:
            db.UpdateStudent(student);

            //  Assert: Tim is still at second year, as the update should've failed.
            var result = db.SearchStudents("Tim", "Firstname");

            Assert.AreEqual(result.Count(), 1);
            Assert.AreEqual(result[0].YearOfStudy, StudentRegistrationApp.Model.YearOfStudyEnum.Second);
        }
        public void UpdateStudentTim()
        {
            //  Arrange;
            var db = new StudentRegistrationApp.Model.StudentRepository();

            var student = new StudentRegistrationApp.Model.Student()
            {
                Firstname   = "Tim",
                Surname     = "Harrison",
                DOB         = new DateTime(1960, 2, 1),
                YearOfStudy = StudentRegistrationApp.Model.YearOfStudyEnum.Third
            };

            //  Act:
            db.UpdateStudent(student);

            //  Assert: Tim is now in Third Year of Study
            var result = db.SearchStudents("Tim", "Firstname");

            Assert.AreEqual(result.Count(), 1);
            Assert.AreEqual(result[0].YearOfStudy, StudentRegistrationApp.Model.YearOfStudyEnum.Third);
        }
        public void UpdateStudentFredDoesNotExist()
        {
            //  Arrange;
            var db = new StudentRegistrationApp.Model.StudentRepository();

            var student = new StudentRegistrationApp.Model.Student()
            {
                Firstname = "Fred",
                Surname = "Harrison",
                DOB = new DateTime(1960, 2, 1),
                YearOfStudy = StudentRegistrationApp.Model.YearOfStudyEnum.Third
            };
            //  Act:
            db.UpdateStudent(student);

            //  Assert: Tim is now in Third Year of Study
            var results = db.GetStudents();

            Assert.AreEqual(results.Count(), 2);
            Assert.AreEqual(results[0].Firstname, "Tim");
            Assert.AreEqual(results[0].YearOfStudy, StudentRegistrationApp.Model.YearOfStudyEnum.Second);
            Assert.AreEqual(results[1].Firstname, "Nancy");
            Assert.AreEqual(results[1].YearOfStudy, StudentRegistrationApp.Model.YearOfStudyEnum.First);
        }
        public void UpdateStudentTimNameChangeWhichShouldFail()
        {
            //  Arrange;
            var db = new StudentRegistrationApp.Model.StudentRepository();

            var student = new StudentRegistrationApp.Model.Student()
            {
                Firstname = "Tim Peter",
                Surname = "Harrison",
                DOB = new DateTime(1960, 2, 1),
                YearOfStudy = StudentRegistrationApp.Model.YearOfStudyEnum.Third
            };
            //  Act:
            db.UpdateStudent(student);

            //  Assert: Tim is still at second year, as the update should've failed.
            var result = db.SearchStudents("Tim", "Firstname");

            Assert.AreEqual(result.Count(), 1);
            Assert.AreEqual(result[0].YearOfStudy, StudentRegistrationApp.Model.YearOfStudyEnum.Second);
        }
        public void UpdateStudentTim()
        {
            //  Arrange;
            var db = new StudentRegistrationApp.Model.StudentRepository();

            var student = new StudentRegistrationApp.Model.Student()
            {
                Firstname = "Tim",
                Surname = "Harrison",
                DOB = new DateTime(1960, 2, 1),
                YearOfStudy = StudentRegistrationApp.Model.YearOfStudyEnum.Third
            };
            //  Act:
            db.UpdateStudent(student);

            //  Assert: Tim is now in Third Year of Study
            var result = db.SearchStudents("Tim", "Firstname");

            Assert.AreEqual(result.Count(), 1);
            Assert.AreEqual(result[0].YearOfStudy, StudentRegistrationApp.Model.YearOfStudyEnum.Third);
        }