Ejemplo n.º 1
0
 public float GetInstructorRating(int instructorId)
 {
     var errors = new List<string>();
     var repository = new CapeReviewRepository(this.entities);
     var service = new CapeReviewService(repository);
     return service.GetInstructorRating(instructorId, ref errors);
 }
Ejemplo n.º 2
0
        public void CapeReviewErrorTest2()
        {
            //// Arranage
            var errors = new List<string>();
            var mockRepository = new Mock<ICapeReviewRepository>();
            var capeService = new CapeReviewService(mockRepository.Object);

            //// Act

            capeService.GetInstructorRating(0, ref errors);

            //// Assert
            Assert.AreEqual(1, errors.Count);
        }
Ejemplo n.º 3
0
        public void CapeReviewGetInstructorReviewTest()
        {
            //// Arrange
            var errors = new List<string>();

            Mock<ICapeReviewRepository> mockRepository = new Mock<ICapeReviewRepository>();
            CapeReviewService capeservice = new CapeReviewService(mockRepository.Object);

            List<CapeReview> crl = new List<CapeReview>();
            crl.Add(new CapeReview { CapeId = 1000, CourseId = 999, InstructorId = 500, Summary = "T", InstructorRating = 3, CourseRating = 1 });
            crl.Add(new CapeReview { CapeId = 1001, CourseId = 999, InstructorId = 500, Summary = "T", InstructorRating = 2, CourseRating = 5 });
            crl.Add(new CapeReview { CapeId = 1002, CourseId = 999, InstructorId = 500, Summary = "T", InstructorRating = 1, CourseRating = 3 });
            mockRepository.Setup(x => x.FindCapeReviewsByInstructorId(500, ref errors)).Returns(crl);

            //// Act
            var rating = capeservice.GetInstructorRating(500, ref errors);

            //// Assert
            Assert.AreEqual(0, errors.Count);
            Assert.AreEqual(2, rating);
        }