Beispiel #1
0
 public TopicsResource(
     IGenericJsonPagedQuery genericJsonPagedQuery,
     ICreateTopicCommand createGroupCommand)
 {
     this.genericJsonPagedQuery = genericJsonPagedQuery;
     this.createGroupCommand    = createGroupCommand;
 }
Beispiel #2
0
 public TopicsResource( 
     IGenericJsonPagedQuery genericJsonPagedQuery,
     ICreateTopicCommand createGroupCommand)
 {
     this.genericJsonPagedQuery = genericJsonPagedQuery;
     this.createGroupCommand = createGroupCommand;
 }
Beispiel #3
0
 public TopicController(
     IEntityById entityById,
     ITopicsSortedByName topicsSortedByName,
     IGroupsSortedByName groupsSortedByName,
     ICreateTopicCommand createTopicCommand,
     IUpdateTopicCommand updateTopicCommand,
     IDeleteTopicCommand deleteTopicCommand)
 {
     this.entityById = entityById;
     this.topicsSortedByName = topicsSortedByName;
     this.groupsSortedByName = groupsSortedByName;
     this.createTopicCommand = createTopicCommand;
     this.updateTopicCommand = updateTopicCommand;
     this.deleteTopicCommand = deleteTopicCommand;
 }
Beispiel #4
0
 public TopicController(
     IEntityById entityById,
     ITopicsSortedByName topicsSortedByName,
     IGroupsSortedByName groupsSortedByName,
     ICreateTopicCommand createTopicCommand,
     IUpdateTopicCommand updateTopicCommand,
     IDeleteTopicCommand deleteTopicCommand)
 {
     this.entityById         = entityById;
     this.topicsSortedByName = topicsSortedByName;
     this.groupsSortedByName = groupsSortedByName;
     this.createTopicCommand = createTopicCommand;
     this.updateTopicCommand = updateTopicCommand;
     this.deleteTopicCommand = deleteTopicCommand;
 }
Beispiel #5
0
        private static TopicController CreateController(
            ITopicsSortedByName topicsSortedByName = null,
            IEntityById entityById = null,
            IGroupsSortedByName groupsSortedByName = null,
            ICreateTopicCommand createTopicCommand = null,
            IUpdateTopicCommand updateTopicCommand = null,
            IDeleteTopicCommand deleteTopicCommand = null)

        {
            var defaultGroupQuery = Mock.Of <IGroupsSortedByName>(q => q.Execute() == new Group[] { SampleGroup });

            return(new TopicController(entityById ?? Mock.Of <IEntityById>(),
                                       topicsSortedByName ?? Mock.Of <ITopicsSortedByName>(),
                                       groupsSortedByName ?? defaultGroupQuery,
                                       createTopicCommand ?? Mock.Of <ICreateTopicCommand>(),
                                       updateTopicCommand ?? Mock.Of <IUpdateTopicCommand>(),
                                       deleteTopicCommand ?? Mock.Of <IDeleteTopicCommand>()
                                       ));
        }
 private static TopicController CreateController(
     ITopicsSortedByName topicsSortedByName = null,
     IEntityById entityById = null,
     IGroupsSortedByName groupsSortedByName = null,
     ICreateTopicCommand createTopicCommand = null,
     IUpdateTopicCommand updateTopicCommand = null,
     IDeleteTopicCommand deleteTopicCommand = null)
 {
     var defaultGroupQuery = Mock.Of<IGroupsSortedByName>(q => q.Execute() == new Group[]{SampleGroup});
     return new TopicController( entityById ?? Mock.Of<IEntityById>(),
                                 topicsSortedByName ?? Mock.Of<ITopicsSortedByName>(),
                                 groupsSortedByName ?? defaultGroupQuery,
                                 createTopicCommand ?? Mock.Of<ICreateTopicCommand>(),
                                 updateTopicCommand ?? Mock.Of<IUpdateTopicCommand>(),
                                 deleteTopicCommand ?? Mock.Of<IDeleteTopicCommand>()
                                 );
 }
 public IActionResult Post([FromBody] TopicDto dto, [FromServices] ICreateTopicCommand command)
 {
     _executor.ExecuteCommand(command, dto);
     return(StatusCode(StatusCodes.Status201Created));
 }