Esempio n. 1
0
        private void ChannelCreated(ChannelCreated message)
        {
            var existingChannelIndex = base.BotState.Channels.FindIndex(c => c.Id == message.Channel.Id);

            if (existingChannelIndex >= 0)
                base.BotState.Channels.RemoveAt(existingChannelIndex);

            base.BotState.Channels.Add(message.Channel);
        }
Esempio n. 2
0
        public void HandlesValidChannelCreated()
        {
            var channels = new List<Channel>
            {
                new Channel { Id = "CHANID1", IsArchived = false },
            };

            var mockState = SetupChannelsMock(channels);

            var message = new ChannelCreated
            {
                Type = EventType.ChannelCreated,
                Channel = new Channel { Id = "CHANID2" }
            };

            RunHandler(message, mockState);

            Assert.Equal(2, channels.Count);
            Assert.True(channels.Any(c => c.Id == "CHANID1"));
            Assert.True(channels.Any(c => c.Id == "CHANID2"));
        }
Esempio n. 3
0
        private void ChannelJoined(ChannelJoined message)
        {
            var createdMessage = new ChannelCreated
            {
                Channel = message.Channel
            };

            ChannelCreated(createdMessage);
        }