Esempio n. 1
0
        private void ChannelArchive(ChannelArchive message)
        {
            var channel = base.BotState.Channels.FirstOrDefault(c => c.Id == message.Channel);

            if (channel == null)
                return;

            channel.IsArchived = true;
        }
Esempio n. 2
0
        public void HandlesValidChannelArchive()
        {
            var channels = new List<Channel>
            {
                new Channel { Id = "CHANID1", IsArchived = false },
                new Channel { Id = "CHANID2", IsArchived = false }
            };

            var mockState = SetupChannelsMock(channels);

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

            RunHandler(message, mockState);

            Assert.Equal(2, channels.Count);
            Assert.Equal(true, channels.First(c => c.Id == "CHANID1").IsArchived);
            Assert.Equal(false, channels.First(c => c.Id == "CHANID2").IsArchived);
        }