Ejemplo n.º 1
0
 public AnswersService
 (
     IAnswersFactory answerFactory
 )
 {
     _answerFactory = answerFactory;
 }
        public QuestionsController(IQuestionsService questionsService,
                                   IAnswersService answersService,
                                   ICategoriesService categoriesService,
                                   IQuestionsFactory questionsFactory,
                                   IAnswersFactory answersFactory)
        {
            Guard.WhenArgument <IQuestionsService>(questionsService, "Questions service cannot be null.")
            .IsNull()
            .Throw();

            Guard.WhenArgument <IAnswersService>(answersService, "Answers service cannot be null.")
            .IsNull()
            .Throw();

            Guard.WhenArgument <ICategoriesService>(categoriesService, "Categories service cannot be null.")
            .IsNull()
            .Throw();

            Guard.WhenArgument <IQuestionsFactory>(questionsFactory, "Questions factory cannot be null.")
            .IsNull()
            .Throw();

            Guard.WhenArgument <IAnswersFactory>(answersFactory, "Answers factory cannot be null.")
            .IsNull()
            .Throw();

            this.questionsService  = questionsService;
            this.answersService    = answersService;
            this.categoriesService = categoriesService;
            this.questionsFactory  = questionsFactory;
            this.answersFactory    = answersFactory;
        }