예제 #1
0
        public QuizManagementService(IQuizRepository quizRepository, IQuizDtoMapper quizDtoMapper, EntityValidator entityValidator, 
            IQuestionDtoMapper questionDtoMapper, IAssignedQuizDtoMapper assignedQuizDtoMapper)
        {
            if (quizRepository == null)
            {
                throw new ArgumentNullException("quizRepository");
            }

            if (quizDtoMapper == null)
            {
                throw new ArgumentNullException("quizDtoMapper");
            }

            if (entityValidator == null)
            {
                throw new ArgumentNullException("entityValidator");
            }

            if (questionDtoMapper == null)
            {
                throw new ArgumentNullException("questionDtoMapper");
            }

            if (assignedQuizDtoMapper == null)
            {
                throw new ArgumentNullException("assignedQuizDtoMapper");
            }

            _quizRepository = quizRepository;
            _quizDtoMapper = quizDtoMapper;
            _entityValidator = entityValidator;
            _questionDtoMapper = questionDtoMapper;
            _assignedQuizDtoMapper = assignedQuizDtoMapper;
        }
        public QuizManagementServiceTest()
        {
            _entityValidator = A.Fake<EntityValidator>();
            _quizRepository = A.Fake<IQuizRepository>();
            _quizDtoMapper = A.Fake<IQuizDtoMapper>();
            _questionDtoMapper = A.Fake<IQuestionDtoMapper>();
            _assignedQuizDtoMapper = A.Fake<IAssignedQuizDtoMapper>();

            _quizManagementService = new QuizManagementService(_quizRepository, _quizDtoMapper, _entityValidator, _questionDtoMapper, _assignedQuizDtoMapper);

            _validQuiz = new Entities.Quiz
                         {
                             Name = "Test",
                             Description = "Description",
                             Questions =
                                 new List<Question>
                                 {
                                     A.Fake<Question>(),
                                     A.Fake<Question>()
                                 }
                         };

            _validAssignment = new AssignedQuizModel
                         {
                            Quiz = new Entities.Quiz(),
                            Group = new Group(),
                            StartDate = DateTime.Now,
                            EndDate = DateTime.Now.AddDays(1)
                         };
        }