コード例 #1
0
ファイル: DeleteGroupCommand.cs プロジェクト: ashic/Hermes
 public DeleteGroupCommand(
     IEntityById entityById,
     IRepository <Group> repository,
     IChildGroupsOfGroup childGroupsOfGroup,
     ITopicsByGroup topicsByGroup)
 {
     this.entityById         = entityById;
     this.repository         = repository;
     this.childGroupsOfGroup = childGroupsOfGroup;
     this.topicsByGroup      = topicsByGroup;
 }
コード例 #2
0
 public DeleteGroupCommand CreateCommand(IEntityById queryEntityById = null, 
     IRepository<Group> cudGroup = null,
     IChildGroupsOfGroup childGroupsOfGroup = null,
     ITopicsByGroup queryTopicsByGroup = null)
 {
     return new DeleteGroupCommand(
                         queryEntityById ?? Mock.Of<IEntityById>(),
                         cudGroup ?? Mock.Of<IRepository<Group>>(),
                         childGroupsOfGroup ?? Mock.Of<IChildGroupsOfGroup>(),
                         queryTopicsByGroup ?? Mock.Of<ITopicsByGroup>());
 }
コード例 #3
0
 public DeleteGroupCommand(
     IEntityById entityById,
     IRepository<Group> repository,
     IChildGroupsOfGroup childGroupsOfGroup,
     ITopicsByGroup topicsByGroup)
 {
     this.entityById = entityById;
     this.repository = repository;
     this.childGroupsOfGroup = childGroupsOfGroup;
     this.topicsByGroup = topicsByGroup;
 }
コード例 #4
0
 public DeleteGroupCommand CreateCommand(IEntityById queryEntityById            = null,
                                         IRepository <Group> cudGroup           = null,
                                         IChildGroupsOfGroup childGroupsOfGroup = null,
                                         ITopicsByGroup queryTopicsByGroup      = null)
 {
     return(new DeleteGroupCommand(
                queryEntityById ?? Mock.Of <IEntityById>(),
                cudGroup ?? Mock.Of <IRepository <Group> >(),
                childGroupsOfGroup ?? Mock.Of <IChildGroupsOfGroup>(),
                queryTopicsByGroup ?? Mock.Of <ITopicsByGroup>()));
 }
コード例 #5
0
ファイル: GroupResource.cs プロジェクト: ashic/Hermes
 public GroupResource(IEntityById entityById,
                      IUpdateGroupCommand updateGroupCommand,
                      IDeleteGroupCommand deleteGroupCommand,
                      ITopicsByGroup topicsByGroup,
                      IGroupByName groupByName)
 {
     this.entityById         = entityById;
     this.updateGroupCommand = updateGroupCommand;
     this.deleteGroupCommand = deleteGroupCommand;
     this.topicsByGroup      = topicsByGroup;
     this.groupByName        = groupByName;
 }
コード例 #6
0
ファイル: GroupResource.cs プロジェクト: jasondentler/Hermes
 public GroupResource(IEntityById entityById,
     IUpdateGroupCommand updateGroupCommand,
     IDeleteGroupCommand deleteGroupCommand,
     ITopicsByGroup topicsByGroup,
     IGroupByName groupByName)
 {
     this.entityById = entityById;
     this.updateGroupCommand = updateGroupCommand;
     this.deleteGroupCommand = deleteGroupCommand;
     this.topicsByGroup = topicsByGroup;
     this.groupByName = groupByName;
 }
コード例 #7
0
        public void Setup()
        {
            var colG = base.mongoDb.GetCollection <Group>(MongoDbConstants.GetCollectionNameForType <Group>());
            var colT = base.mongoDb.GetCollection <Topic>(MongoDbConstants.GetCollectionNameForType <Topic>());

            for (var i = 0; i < 4; i++)
            {
                // Add group
                var group = new Group
                {
                    Name     = "Group Foo " + i,
                    ParentId = (i == 1 || i == 2) ? groupIds[i - 1] : new Identity?()                 // Set group hierarchy
                };
                colG.Save(group);
                groupIds[i] = group.Id.Value;

                // Add a topic to the group
                var topic = new Topic {
                    Name = "Topic foo " + i, GroupId = group.Id.Value
                };
                colT.Save(topic);
                topicIds[i] = topic.Id.Value;

                // Add a message to the topic
                var colM    = base.mongoDb.GetCollection <Message>(MongoDbConstants.GetCollectionNameForMessage(topicIds[i]));
                var message = new Message
                {
                    UtcReceivedOn = DateTime.UtcNow,
                    TopicId       = topicIds[i],
                    Payload       = new byte[] { 1, 2, 3, 4, 5 }
                };
                colM.Save(message);
                msgIds[i] = message.Id.Value;
            }

            childGroupsOfGroup = Mock.Of <IChildGroupsOfGroup>(q =>
                                                               q.GetChildrenIds(groupIds[0]) == groupIds.Skip(1).Take(1) &&
                                                               q.GetChildrenIds(groupIds[1]) == groupIds.Skip(2).Take(1) &&
                                                               q.GetChildrenIds(groupIds[2]) == new Identity[0] &&
                                                               q.GetChildrenIds(groupIds[3]) == new Identity[0]);

            topicsByGroup = Mock.Of <ITopicsByGroup>(q =>
                                                     q.GetTopicIds(groupIds[0], null, null) == topicIds.Skip(0).Take(1) &&
                                                     q.GetTopicIds(groupIds[1], null, null) == topicIds.Skip(1).Take(1) &&
                                                     q.GetTopicIds(groupIds[2], null, null) == topicIds.Skip(2).Take(1) &&
                                                     q.GetTopicIds(groupIds[3], null, null) == topicIds.Skip(3).Take(1));
        }
コード例 #8
0
ファイル: MessageKeysByGroup.cs プロジェクト: ashic/Hermes
 public MessageKeysByGroup(string connectionString, IChildGroupsOfGroup childGroupsOfGroup, ITopicsByGroup topicByGroup)
     : base(connectionString)
 {
     this.childGroupsOfGroup = childGroupsOfGroup;
     this.topicByGroup = topicByGroup;
 }
コード例 #9
0
 private MessageKeysByGroup CreateQuery(IChildGroupsOfGroup childGroupsOfGroup, ITopicsByGroup topicsByGroup)
 {
     return(new MessageKeysByGroup(base.connectionString,
                                   childGroupsOfGroup ?? Mock.Of <IChildGroupsOfGroup>(),
                                   topicsByGroup ?? Mock.Of <ITopicsByGroup>()));
 }
コード例 #10
0
 public MessageKeysByGroup(string connectionString, IChildGroupsOfGroup childGroupsOfGroup, ITopicsByGroup topicByGroup)
     : base(connectionString)
 {
     this.childGroupsOfGroup = childGroupsOfGroup;
     this.topicByGroup       = topicByGroup;
 }