Ejemplo n.º 1
0
 public TopicsController(IGetTopicsCommand getCommand, IGetTopicCommand getOneCommand, IAddTopicCommand addCommand, IDeleteTopicCommand deleteCommand, IUpdateTopicCommand updateCommand)
 {
     _getCommand    = getCommand;
     _getOneCommand = getOneCommand;
     _addCommand    = addCommand;
     _deleteCommand = deleteCommand;
     _updateCommand = updateCommand;
 }
Ejemplo n.º 2
0
 public TopicResource(IEntityById entityById,
                      IUpdateTopicCommand updateGroupCommand,
                      IDeleteTopicCommand deleteGroupCommand,
                      ITopicByName topicByName)
 {
     this.entityById         = entityById;
     this.updateGroupCommand = updateGroupCommand;
     this.deleteGroupCommand = deleteGroupCommand;
     this.topicByName        = topicByName;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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>()
                                       ));
        }
Ejemplo n.º 6
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>()
                                 );
 }
Ejemplo n.º 7
0
 public IActionResult Put(int id, [FromBody] TopicDto dto, [FromServices] IUpdateTopicCommand command)
 {
     dto.Id = id;
     _executor.ExecuteCommand(command, dto);
     return(NoContent());
 }