public void TestAddEmailWithStudentId()
        {
            //Arrange
            var student = new Student
            {
                FirstName = "firstname1",
                LastName = "lastname1",
                CNP = "1234567891234",
                SID = 123,
                EnrollmentDate = DateTime.Now,
                Emails = new[] { new Email("*****@*****.**"),  }
            };

            var address = new Address
            {
                City = "New York",
                Country = "USA",
                State = "NYQ",
                PostalCode = "12356",
                Street = "353",
                Student = student
            };

            student.Address = address;

            using (var st = new StudentService())
            {
                st.AddStudent(student);
            }

            var email = new Email("*****@*****.**") { StudentId = student.StudentId };

            //Act
            using (var es = new EmailService())
            {
                es.AddEmail(email);
            }

            //Assert
            var res = Validation.Validate(email);
            Assert.AreEqual(res.IsValid, true, res.IsValid ? "" : "Validation Failed: " + res.First().Message);

            if (!res.IsValid)
            {
                var firstOrDefault = res.FirstOrDefault();
                if (firstOrDefault != null) Trace.WriteLine(firstOrDefault.Message);
            }

            Assert.AreEqual(student.StudentId, email.StudentId);
        }
        public void TestAddEmailToStudent()
        {
            var student = new Student
            {
                FirstName = "firstname1",
                LastName = "lastname1",
                CNP = "1234567891234",
                SID = 123,
                EnrollmentDate = DateTime.Now,
                Emails = new[] { new Email("*****@*****.**") }
            };

            var address = new Address
            {
                City = "New York",
                Country = "USA",
                State = "NYQ",
                PostalCode = "12356",
                Street = "353",
                Student = student
            };

            student.Address = address;

            using (var es = new EmailService())
            using (var st = new StudentService())
            {
                st.AddStudent(student);
                var email = new Email("*****@*****.**") { StudentId = student.StudentId };
                es.AddEmail(email);
                var res = Validation.Validate(email);
                Assert.AreEqual(res.IsValid, true, res.IsValid ? "" : "Validation Failed: " + res.First().Message);

                if (!res.IsValid)
                {
                    var firstOrDefault = res.FirstOrDefault();
                    if (firstOrDefault != null) Trace.WriteLine(firstOrDefault.Message);
                }

                var stud = st.GetStudentById(student.StudentId);
                Assert.AreEqual(stud.StudentId, student.StudentId);
                Assert.IsTrue(stud.Emails.Any(e => e.EmailAddress == email.EmailAddress));
            }
        }