Пример #1
0
        public async Task GetCommentByPostIdWorkCorrectly()
        {
            var comment = new Comment()
            {
                Text           = "test",
                UserId         = "a",
                AnnouncementId = "1",
            };

            await this.dbContext.Comments.AddAsync(comment);

            await this.dbContext.SaveChangesAsync();

            var service = new CommentsService(this.commentRepository);
            var result  = service.GetCommentByPostId <CommentInputModel>("1");

            Assert.Equal(1, result?.Count());
        }