public async Task UpdateAsyncShould_ReturnsFalseIf_EventCreatorIsAnotherUser()
        {
            const string UpdaterId = "789io87714w78ex5";

            //Arrange
            var htmlServiceMock = IHtmlServiceMock.New(ContentForUpdate);

            var service = new BlogArticleService(Db, htmlServiceMock.Object, null);

            var author = UserCreator.Create();

            await this.Db.AddAsync(author);

            var article = ArticleCreator.Create(author.Id, null);

            await this.Db.AddAsync(article);

            await this.Db.SaveChangesAsync();

            //Act
            var result = await service.UpdateAsync(article.Id, UpdaterId, TitleForUpdate, ContentForUpdate);

            //Assert
            result.Should().BeFalse();

            htmlServiceMock.Verify(h => h.Sanitize(It.IsAny <string>()), Times.Never);
        }
        public async Task CreateAsyncShould_SetTheCorrectParametersForArticlePropertiesAnd_ReturnsArticleId()
        {
            const int    NewImageId = 258;
            const string Title      = "Title";
            const string Content    = "Content123";
            const string AuthorId   = "8945opi7563k87";

            //Arrange
            var picService = IPictureServiceMock.New(NewImageId);

            var htmlService = IHtmlServiceMock.New(Content);

            var service = new BlogArticleService(Db, htmlService.Object, picService.Object);

            //Act
            var resultId = await service.CreateAsync(Title, Content, null, AuthorId);

            var savedEntry = await Db.FindAsync <Article>(resultId);

            //Assert
            resultId.Should().Be(savedEntry.Id);

            htmlService.Verify(h => h.Sanitize(It.IsAny <string>()), Times.Once);

            picService.Verify(p =>
                              p.UploadImageAsync(It.IsAny <string>(), It.IsAny <IFormFile>()), Times.Once);

            savedEntry.Id.Should().Be(resultId);
            savedEntry.Title.Should().Match(Title);
            savedEntry.Content.Should().Match(Content);
            savedEntry.AuthorId.Should().Match(AuthorId);
            savedEntry.CloudinaryImageId.Should().Be(NewImageId);
        }
        public async Task UpdateAsyncShould_UpdateTheCorrectPropertiesAnd_ShouldReturnsTrueIf_EventCreatorIsTheSame()
        {
            //Arrange
            var htmlService = IHtmlServiceMock.New(ContentForUpdate);

            var service = new BlogArticleService(Db, htmlService.Object, null);

            var author = UserCreator.Create();

            await this.Db.AddAsync(author);

            var article = ArticleCreator.Create(author.Id, null);

            await this.Db.AddAsync(article);

            await this.Db.SaveChangesAsync();

            //Act
            var result = await service.UpdateAsync(article.Id, author.Id, TitleForUpdate, ContentForUpdate);

            var updatedEntry = await Db.FindAsync <Article>(article.Id);

            //Assert
            result.Should().BeTrue();

            htmlService.Verify(h => h.Sanitize(It.IsAny <string>()), Times.Once);

            Assert.Equal(updatedEntry.Title, TitleForUpdate);
            Assert.Equal(updatedEntry.Content, ContentForUpdate);
        }