public void HandlesValidGroupJoined() { var groups = new List <Group> { new Group { Id = "CHANID1", IsOpen = false }, new Group { Id = "CHANID2", IsOpen = true } }; var mockState = SetupGroupsMock(groups); var message = new GroupJoined { Type = EventType.GroupJoined, Channel = new Group { Id = "CHANID1", IsOpen = true } }; RunHandler(message, mockState); Assert.True(groups.All(c => c.IsOpen)); }
private void GroupJoined(GroupJoined message) { var existingGroupIndex = base.BotState.Groups.FindIndex(c => c.Id == message.Channel.Id); if (existingGroupIndex >= 0) base.BotState.Groups.RemoveAt(existingGroupIndex); base.BotState.Groups.Add(message.Channel); }
public void JoinGroup(string groupId, BuddyJoinType joinType) { if (joinType == BuddyJoinType.New && CurrentGroupId != null) { throw new InvalidOperationException("Can't join group when still being in another one"); } var e = new GroupJoined(Id, groupId); Publish(e); }
private void GroupJoined(GroupJoined message) { var existingGroupIndex = base.BotState.Groups.FindIndex(c => c.Id == message.Channel.Id); if (existingGroupIndex >= 0) { base.BotState.Groups.RemoveAt(existingGroupIndex); } base.BotState.Groups.Add(message.Channel); }
public void HandleGroupJoined(GroupJoined joined) { GroupLookup.Add(joined.channel.id, joined.channel); }
private void When(GroupJoined e) { CurrentGroupId = e.GroupId; }