public void TestDeleteExamAsObjectSuccess()
        {
            var course1 = new Course
            {
                Name = "C# 44",
                Description = "Programming in .NET Framework With C#",
                Credits = 8,
                Cost = 400,
                Currency = "EUR",
                LowerBound = 10,
                UpperBound = 100
            };

            var courseService = new CourseService();
            courseService.AddCourse(course1);

            var student = new Student
            {
                FirstName = "name",
                LastName = "sdjjkghsjkghsk",
                CNP = "1234567891234",
                SID = 123,
                EnrollmentDate = DateTime.Now,
                Emails = new[] { new Email("*****@*****.**"), }
            };

            var exam = new Exam
            {
                Course = course1,
                Student = student,
                Grade = 6,
                ExaminationDate = DateTime.Now,
            };

            _examService.AddExam(exam);

            var isInserted = _examService.IsExamInserted(exam.ExamId);

            Assert.AreEqual(true, isInserted);
            _examService.DeleteExam(exam);

            var isInserted2 = _examService.IsExamInserted(exam.ExamId);

            Assert.AreEqual(false, isInserted2);
        }
        public void TestExamCoreqFailed()
        {
            var course1 = new Course
            {
                Name = "C# 44",
                Description = "Programming in .NET Framework With C#",
                Credits = 8,
                Cost = 400,
                Currency = "EUR",
                LowerBound = 10,
                UpperBound = 100
            };

            var course2 = new Course
            {
                Name = "C# 18",
                Description = "Programming in .NET Framework With C#",
                Credits = 3,
                Cost = 50,
                Currency = "EUR",
                LowerBound = 10,
                UpperBound = 100
            };

            course1.CourseCoRequisites.Add(course2);

            var courseService = new CourseService();
            courseService.AddCourse(course1);
            courseService.AddCourse(course2);

            var student = new Student
            {
                FirstName = "name",
                LastName = "sdjjkghsjkghsk",
                CNP = "1234567891234",
                SID = 123,
                EnrollmentDate = DateTime.Now,
                Emails = new[] { new Email("*****@*****.**"), }
            };

            var studentService = new StudentService();
            studentService.AddStudent(student);

            var exam = new Exam
            {
                Course = course1,
                Student = student,
                Grade = 6,
                ExaminationDate = DateTime.Now,
            };

            var exam1 = new Exam
            {
                Course = course2,
                Student = student,
                Grade = 6,
                ExaminationDate = DateTime.Now,
            };

            _examService.AddExam(exam1);
            //_examService.AddExam(exam);

            var res = Validation.Validate(exam);
            Assert.AreEqual(false, res.IsValid, res.IsValid ? "" : "Validation Failed: " + res.Single().Message);

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

            //_examService.DeleteExam(exam2);
            //_examService.DeleteExam(exam);
        }
        public void TestUpdateExamSuccess2()
        {
            var course1 = new Course
            {
                Name = "C# 44",
                Description = "Programming in .NET Framework With C#",
                Credits = 8,
                Cost = 400,
                Currency = "EUR",
                LowerBound = 10,
                UpperBound = 100
            };

            var courseService = new CourseService();
            courseService.AddCourse(course1);

            var student = new Student
            {
                FirstName = "name",
                LastName = "sdjjkghsjkghsk",
                CNP = "1234567891234",
                SID = 123,
                EnrollmentDate = DateTime.Now,
                Emails = new[] { new Email("*****@*****.**"), }
            };

            var exam = new Exam
            {
                Course = course1,
                Student = student,
                Grade = 6,
                ExaminationDate = DateTime.Now,
            };

            _examService.AddExam(exam);
            exam.Grade = 8;
            _examService.UpdateExam(exam.ExamId,exam);

            var updatedExam = _examService.GetExamById(exam.ExamId);

            Assert.AreEqual(8, updatedExam.Grade);
        }
 public void MyTestInitialize()
 {
     _courseService = new CourseService();
     _examService = new ExamService();
 }
        public void TestGetAverageGradeForCourse()
        {
            var course1 = new Course
            {
                Name = "C# 44",
                Description = "Programming in .NET Framework With C#",
                Credits = 8,
                Cost = 400,
                Currency = "EUR",
                LowerBound = 10,
                UpperBound = 100
            };

            var courseService = new CourseService();
            courseService.AddCourse(course1);

            var student = new Student
            {
                FirstName = "name",
                LastName = "sdjjkghsjkghsk",
                CNP = "1234567891234",
                SID = 123,
                EnrollmentDate = DateTime.Now,
                Emails = new[] { new Email("*****@*****.**"), }
            };

            var student2 = new Student
            {
                FirstName = "qwewq",
                LastName = "asdasdsa",
                CNP = "1234567891234",
                SID = 123,
                EnrollmentDate = DateTime.Now,
                Emails = new[] { new Email("*****@*****.**"), }
            };

            var exam = new Exam
            {
                Course = course1,
                Student = student,
                Grade = 6,
                ExaminationDate = DateTime.Now,
            };

            _examService.AddExam(exam);

            var exam2 = new Exam
            {
                Course = course1,
                Student = student2,
                Grade = 8,
                ExaminationDate = DateTime.Now,
            };

            _examService.AddExam(exam2);

            Assert.AreEqual(7, _courseService.GetAverageGradeForCourse(course1.CourseId));
        }
        public void TestGetAllCourses()
        {
            var courseService = new CourseService();
            var list = courseService.GetCourses();
            var count = list.Count;

            var c1 = new Course
            {
                Name = "C# 10",
                Description = "Programming in .NET Framework With C#",
                Credits = 8,
                Cost = 400,
                Currency = "EUR",
                LowerBound = 10,
                UpperBound = 110,
                //Semesters = new[] { semester }
            };

            courseService.AddCourse(c1);
            var count2 = courseService.GetCourses().Count;
            Assert.AreEqual(count + 1,count2);
        }
        public void TestIsCourseInsertedFalse()
        {
            var courseService = new CourseService();

            var c1 = new Course
            {
                Name = "C# 10",
                Description = "Programming in .NET Framework With C#",
                Credits = 8,
                Cost = 400,
                Currency = "EUR",
                LowerBound = 10,
                UpperBound = 110,
                //Semesters = new[] { semester }
            };

            courseService.AddCourse(c1);
            var result = courseService.IsCourseInserted(-1);
            Assert.AreEqual(false, result);
        }
 public void MyTestInitialize()
 {
     _studentService = new StudentService();
     _courseService = new CourseService();
 }