Example #1
0
        public void Aprove_ShouldCallSubmissionRepository_Update(int id)
        {
            //Arrange
            var mockSubmissionRepository = new Mock <IRepository <Submission> >();

            var fakeSubmission = new Submission();

            mockSubmissionRepository.Setup(x => x.GetById(id)).Returns(fakeSubmission);

            var mockQuestionService        = new Mock <IQuestionUtility>();
            var mockDateTimeProvider       = new Mock <IDateTimeProvider>();
            var mockAuthenticationProvider = new Mock <IAuthenticationProvider>();
            var mockUnitOfWork             = new Mock <IUnitOfWork>();

            var controller = new ModerationService(mockSubmissionRepository.Object,
                                                   mockQuestionService.Object,
                                                   mockDateTimeProvider.Object,
                                                   mockAuthenticationProvider.Object,
                                                   mockUnitOfWork.Object
                                                   );

            //Act
            controller.Approve(id);

            //Assert
            mockSubmissionRepository.Verify(x => x.Update(fakeSubmission), Times.Once);
        }