public void CanDeleteComment() { var commentRepository = new Mock<IFlyCommentRepository>(); commentRepository.Setup(s => s.GetAll()) .Returns(new List<FlyComment> { new FlyComment {Id = 1, Author = new FlyOwner {Id = 1}, Fly = new Fly {Id = 1}, Comment = "Comment" }, new FlyComment {Id = 2, Author = new FlyOwner {Id = 2}, Fly = new Fly {Id = 1}, Comment = "Comment 2" } }.AsQueryable()); var commentService = new FlyCommentService(commentRepository.Object); commentService.Delete(1); commentRepository.Verify(v => v.Delete(It.IsAny<int>()), Times.Once()); }