Ejemplo n.º 1
0
        public void Question_ShouldRenderView(int id)
        {
            // Arrange
            var mockModerationService = new Mock <IModerationService>();
            var mockQuestionService   = new Mock <IQuestionUtility>();
            var mockViewModelFactory  = new Mock <IViewModelFactory>();

            var controller = new ModerationController(mockModerationService.Object,
                                                      mockQuestionService.Object,
                                                      mockViewModelFactory.Object);

            //Act && Assert
            controller.WithCallTo(x => x.Question(id)).ShouldRenderDefaultView();
        }
Ejemplo n.º 2
0
        public void Submissions_ShouldRenderView(int count, int page)
        {
            // Arrange
            var mockModerationService = new Mock <IModerationService>();
            var mockQuestionService   = new Mock <IQuestionUtility>();
            var mockViewModelFactory  = new Mock <IViewModelFactory>();

            var controller = new ModerationController(mockModerationService.Object,
                                                      mockQuestionService.Object,
                                                      mockViewModelFactory.Object);

            //Act && Assert
            controller.WithCallTo(x => x.Submissions(count, page)).ShouldRenderDefaultView();
        }
Ejemplo n.º 3
0
        public void Approve_ShouldRenderView(int id)
        {
            // Arrange
            var mockModerationService = new Mock <IModerationService>();

            mockModerationService.Setup(x => x.Approve(id)).Returns(new Question {
                Id = 0
            });

            var mockQuestionService  = new Mock <IQuestionUtility>();
            var mockViewModelFactory = new Mock <IViewModelFactory>();

            var controller = new ModerationController(mockModerationService.Object,
                                                      mockQuestionService.Object,
                                                      mockViewModelFactory.Object);

            //Act && Assert
            controller.WithCallTo(x => x.Approve(id)).ShouldRedirectTo(x => x.Question);
        }