public List<Enrollment> GetEnrollments(string id)
 {
     var errors = new List<string>();
     var repository = new StudentRepository();
     var service = new StudentService(repository);
     return service.GetEnrollments(id, ref errors);
 }
Esempio n. 2
0
        public void CalculateGpaNoEnrollmentTest()
        {
            //// Arrange
            var errors = new List<string>();

            var mockRepository = new Mock<IStudentRepository>();
            var studentService = new StudentService(mockRepository.Object);
            mockRepository.Setup(x => x.GetEnrollments("testId", ref errors)).Returns(new List<Enrollment>());

            //// Act
            var enrollments = studentService.GetEnrollments("testId", ref errors);
            var gap = studentService.CalculateGpa("testId", ref errors);

            //// Assert
            Assert.AreEqual(0, errors.Count);
            Assert.AreEqual(0.0f, gap);
        }
        public void GetEnrollmentsTest()
        {
            // Arrange
            var errors = new List<string>();
            var mockRepository = new Mock<IStudentRepository>();
            var studentService = new StudentService(mockRepository.Object);

            // Act
            studentService.GetEnrollments(null, ref errors);

            // Assert
            Assert.AreEqual(1, errors.Count);
        }