コード例 #1
0
        public void IsImShouldNotMatchMissingDirectMessage()
        {
            var ims = new List <DirectMessageChannel>()
            {
                new DirectMessageChannel {
                    Id = "BADID1"
                },
                new DirectMessageChannel {
                    Id = "BADID2"
                },
                new DirectMessageChannel {
                    Id = "BADID3"
                }
            };

            var mockState = new Mock <IBotState>();

            mockState.Setup(m => m.Ims).Returns(ims).Verifiable();

            var message = new PlainMessage()
            {
                Type    = EventType.Message,
                Subtype = MessageSubType.PlainMessage,
                Channel = "TESTID"
            };

            var result = EventMessageExtensions.IsIm(message, mockState.Object);

            mockState.Verify();
            Assert.False(result);
        }
コード例 #2
0
        public void IsImShouldNotMatchNonPlainMessages()
        {
            var mockState = new Mock <IBotState>();

            var message = new MeMessage()
            {
                Type    = EventType.Message,
                Subtype = MessageSubType.MeMessage,
                Channel = "TESTID"
            };

            var result = EventMessageExtensions.IsIm(message, mockState.Object);

            Assert.False(result);
        }