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

            if (existingChannelIndex >= 0)
                base.BotState.Channels.RemoveAt(existingChannelIndex);
        }
Ejemplo n.º 2
0
        public void HandlesValidChannelDeleted()
        {
            var channels = new List<Channel>
            {
                new Channel { Id = "CHANID1", IsArchived = false },
                new Channel { Id = "CHANID2", IsArchived = false }
            };

            var mockState = SetupChannelsMock(channels);

            var message = new ChannelDeleted
            {
                Type = EventType.ChannelDeleted,
                Channel = "CHANID1"
            };

            RunHandler(message, mockState);

            Assert.Equal(1, channels.Count);
            Assert.Equal("CHANID2", channels[0].Id);
        }