コード例 #1
0
        public void GetPendingSubmissions_ShouldReturnInstanceOfIEnumerable()
        {
            //Arrange
            var mockSubmissionRepository   = new Mock <IRepository <Submission> >();
            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
            var result = controller.GetPendingSubmissions();

            //Assert
            Assert.IsInstanceOf <IEnumerable <Submission> >(result);
        }
コード例 #2
0
        public void GetPendingSubmissions_ShouldCallSubmissionRepository_GetAll()
        {
            //Arrange
            var mockSubmissionRepository   = new Mock <IRepository <Submission> >();
            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.GetPendingSubmissions();

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