public void IsToMeShouldNotMatchWhenNotNamed() { var selfData = new SelfBotData { Id = "BOTID" }; var mockState = new Mock <IBotState>(); mockState.Setup(m => m.Ims).Returns(new List <DirectMessageChannel>()).Verifiable(); mockState.Setup(m => m.Self).Returns(selfData).Verifiable(); var message = new PlainMessage() { Type = EventType.Message, Subtype = MessageSubType.PlainMessage, Channel = "TESTID", Text = "<@OTHERID>: test message" }; var result = EventMessageExtensions.IsToMe(message, mockState.Object); mockState.Verify(); Assert.False(result); }
public void IsToMeMatchesWhenIm() { var ims = new List <DirectMessageChannel>() { new DirectMessageChannel { Id = "TESTID" } }; 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.IsToMe(message, mockState.Object); Assert.True(result); }