コード例 #1
0
        public void HandlesValidChannelUnarchive()
        {
            var channels = new List<Channel>
            {
                new Channel { Id = "CHANID1", IsArchived = true },
                new Channel { Id = "CHANID2", IsArchived = false }
            };

            var mockState = SetupChannelsMock(channels);

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

            RunHandler(message, mockState);

            Assert.Equal(2, channels.Count);
            Assert.Equal(false, channels.First(c => c.Id == "CHANID1").IsArchived);
            Assert.Equal(false, channels.First(c => c.Id == "CHANID2").IsArchived);
        }
コード例 #2
0
ファイル: ChannelHandler.cs プロジェクト: vampireneo/slack
        private void ChannelUnarchive(ChannelUnarchive message)
        {
            var channel = base.BotState.Channels.FirstOrDefault(c => c.Id == message.Channel);

            if (channel == null)
                return;

            channel.IsArchived = false;
        }