public async Task ShouldRemoveConversation() { // Arrange FbHookChange change = MakeFbHookChangeForRemovingComment(); var dependencyResolverMock = new Mock <IDependencyResolver>(); var messageServiceMock = new Mock <IMessageService>(); messageServiceMock.Setup(t => t.FindByOriginalId( new[] { MessageSource.FacebookPostComment, MessageSource.FacebookPostReplyComment }, change.Value.CommentId) ).Returns(new Message { Id = 111 }); dependencyResolverMock.Setup(t => t.Resolve <IMessageService>()).Returns(messageServiceMock.Object); var strategry = new RemovePostCommentStrategy(dependencyResolverMock.Object); var socialAccount = new SocialAccount { Token = "token" }; // Act var processResult = await strategry.Process(socialAccount, change); // Assert Assert.Equal(1, processResult.DeletedMessages.Count()); var conversation = processResult.DeletedMessages.First(); Assert.Equal(111, conversation.Id); }
public void ShouldNotMatchStrategy() { // Arrange var dependencyResolverMock = new Mock <IDependencyResolver>(); var strategy = new RemovePostCommentStrategy(dependencyResolverMock.Object); var fbHookChange = new FbHookChange { Field = "feed", Value = new FbHookChangeValue { Item = "post", PostId = "post_1", Verb = "add" } }; // Act bool isMatch = strategy.IsMatch(fbHookChange); // Assert Assert.False(isMatch); }