public async void CreateCommentAsync_Positive_TestAsync()
        {
            var options = new DbContextOptionsBuilder <ApartmentContext>()
                          .UseInMemoryDatabase(databaseName: "CreateCommentAsync_PositiveAndNegative_TestAsync")
                          .Options;

            using (var context = new ApartmentContext(options))
            {
                context.AddRange(_users);
                context.AddRange(_apartments);

                await context.SaveChangesAsync();
            }

            using (var context = new ApartmentContext(options))
            {
                var user      = context.Users.AsNoTracking().FirstOrDefault();;
                var apartment = context.Apartments.AsNoTracking().FirstOrDefault();;

                AddComment comment = new AddComment()
                {
                    ApartmentId = apartment.Id.ToString(),
                    Title       = "Title",
                    Text        = "Text"
                };

                var service = new CommentUserService(context, _mapper);

                var resultPositive = await service.CreateCommentAsync(comment, user.Id.ToString());

                resultPositive.IsSuccess.Should().BeTrue();
                resultPositive.Data.Title.Should().BeEquivalentTo(comment.Title);
            }
        }
        public async void DeleteCommentByIdAsync_PositiveAndNegative_TestAsync()
        {
            var options = new DbContextOptionsBuilder <ApartmentContext>()
                          .UseInMemoryDatabase(databaseName: "DeleteCommentByIdAsync_PositiveAndNegative_TestAsync")
                          .Options;

            using (var context = new ApartmentContext(options))
            {
                foreach (var item in _comments)
                {
                    item.AuthorId = Guid.NewGuid();
                }

                context.AddRange(_comments);
                await context.SaveChangesAsync();
            }

            using (var context = new ApartmentContext(options))
            {
                var comment = await context.Comments.AsNoTracking().FirstOrDefaultAsync();

                var service = new CommentUserService(context, _mapper);

                var resultPositive = await service.DeleteCommentByIdAsync(comment.Id.ToString(), comment.AuthorId.ToString());

                var resultNegative = await service.DeleteCommentByIdAsync(new Guid().ToString(), new Guid().ToString());

                resultPositive.IsSuccess.Should().BeTrue();
                resultPositive.Message.Should().BeNull();

                resultNegative.IsSuccess.Should().BeFalse();
                resultNegative.Message.Should().Contain("Comment was not found");
            }
        }
        public async void GetCommentByIdAsync_PositiveAndNegative_TestAsync()
        {
            var options = new DbContextOptionsBuilder <ApartmentContext>()
                          .UseInMemoryDatabase(databaseName: "GetCommentByIdAsync_PositiveAndNegative_TestAsync")
                          .Options;

            using (var context = new ApartmentContext(options))
            {
                context.AddRange(_comments);
                await context.SaveChangesAsync();
            }

            using (var context = new ApartmentContext(options))
            {
                var comment = await context.Comments.AsNoTracking().FirstOrDefaultAsync();

                var service = new CommentUserService(context, _mapper);

                var resultPositive = await service.GetCommentByIdAsync(comment.Id.ToString());

                var resultNegative = await service.GetCommentByIdAsync(new Guid().ToString());

                resultPositive.IsSuccess.Should().BeTrue();
                resultPositive.Data.Title.Should().BeEquivalentTo(comment.Title);

                resultNegative.IsSuccess.Should().BeFalse();
                resultNegative.Data.Should().BeNull();
            }
        }
        public async void GetAllCommentsByUserIdAsync_PositiveAndNegative_TestAsync()
        {
            var options = new DbContextOptionsBuilder <ApartmentContext>()
                          .UseInMemoryDatabase(databaseName: "GetAllCommentsByUserIdAsync_PositiveAndNegative_Test")
                          .Options;

            User userWithComments;

            using (var context = new ApartmentContext(options))
            {
                context.AddRange(_users);
                await context.SaveChangesAsync();

                userWithComments = context.Users.AsNoTracking().FirstOrDefault();

                foreach (var item in _comments)
                {
                    item.AuthorId = userWithComments.Id;
                }

                context.AddRange(_comments);
                await context.SaveChangesAsync();
            }

            using (var context = new ApartmentContext(options))
            {
                var service = new CommentUserService(context, _mapper);

                var commentsInBase = await context.Comments.AsNoTracking().ToListAsync();

                var userWithoutComments = await context.Users.Where(_ => _.Id != userWithComments.Id).FirstOrDefaultAsync();

                var resultPositive = await service.GetAllCommentsByAuthorIdAsync(userWithComments.Id.ToString(), new Common.PagedRequest());

                var resultNegative = await service.GetAllCommentsByAuthorIdAsync(userWithoutComments.Id.ToString(), new Common.PagedRequest());

                foreach (var item in commentsInBase)
                {
                    resultPositive.Data.Data
                    .Where(_ => _.Id == item.Id.ToString())
                    .FirstOrDefault()
                    .Should().NotBeNull();
                }

                resultNegative.Data.Data.Should().BeEmpty();
            }
        }
        public async void UpdateCommentAsync_PositiveAndNegative_TestAsync()
        {
            var options = new DbContextOptionsBuilder <ApartmentContext>()
                          .UseInMemoryDatabase(databaseName: "UpdateCommentAsync_PositiveAndNegative_TestAsync")
                          .Options;

            using (var context = new ApartmentContext(options))
            {
                context.AddRange(_comments);
                await context.SaveChangesAsync();
            }

            using (var context = new ApartmentContext(options))
            {
                var comment = await context.Comments.AsNoTracking().FirstOrDefaultAsync();

                var service = new CommentUserService(context, _mapper);

                CommentDTO updateComment = new CommentDTO()
                {
                    Id    = comment.Id.ToString(),
                    Title = "Title",
                    Text  = "newText"
                };

                CommentDTO failComment = new CommentDTO()
                {
                    Id    = new Guid().ToString(),
                    Title = "newTitle",
                    Text  = "newText"
                };

                var resultPositive = await service.UpdateCommentAsync(updateComment);

                var resultNegative = await service.UpdateCommentAsync(failComment);

                resultPositive.IsSuccess.Should().BeTrue();
                resultPositive.Data.Title.Should().BeEquivalentTo(updateComment.Title);
                resultPositive.Data.Title.Should().NotBeEquivalentTo(comment.Title);

                resultNegative.IsSuccess.Should().BeFalse();
            }
        }