public static void AddChapterContent(this IDbConnection connection, ChapterContentDto content) { var sql = "Insert Into ChapterContent (ChapterId, Language, Text) OUTPUT Inserted.Id VALUES (@ChapterId, @Language, @Text)"; var id = connection.ExecuteScalar <int>(sql, content); content.Id = id; }
internal ChapterContentAssert ShouldMatch(ChapterContentDto content, int bookId, IDbConnection dbConnection) { _chapterContent.ChapterId.Should().Be(content.ChapterId); _chapterContent.BookId.Should().Be(bookId); _chapterContent.Language.Should().Be(content.Language); return(this); }
internal void ShouldHaveContentLink(ChapterContentDto content) { var actual = _chapter.Contents.Single(x => x.Id == content.Id); actual.SelfLink() .ShouldBeGet() .ShouldHaveAcceptLanguage(content.Language); }
public async Task Setup() { _chapter = ChapterBuilder.WithLibrary(LibraryId).Public().WithContents().Build(); _content = ChapterBuilder.Contents.Single(x => x.ChapterId == _chapter.Id); _response = await Client.GetAsync($"/libraries/{LibraryId}/books/{_chapter.BookId}/chapters/{_chapter.ChapterNumber}/contents?language={_content.Language}"); _assert = new ChapterContentAssert(_response, LibraryId); }
public async Task Setup() { _chapter = ChapterBuilder.WithLibrary(LibraryId).Public().WithContents().Build(); _content = ChapterBuilder.Contents.Single(x => x.ChapterId == _chapter.Id); _newContents = RandomData.String; _response = await Client.PutString($"/libraries/{LibraryId}/books/{_chapter.BookId}/chapters/{_chapter.Id}/contents?language={_content.Language}", _newContents); }
public async Task Setup() { var _newContents = RandomData.Words(12); var chapter = ChapterBuilder.WithLibrary(LibraryId).WithContents().Build(); _content = ChapterBuilder.Contents.Single(x => x.ChapterId == chapter.Id); _response = await Client.DeleteAsync($"/libraries/{LibraryId}/books/{chapter.BookId}/chapters/{chapter.ChapterNumber}/contents?language={_content.Language}"); }
internal ChapterAssert ShouldHaveDeleteChapterContentLink(ChapterContentDto content) { var actual = _chapter.Contents.Single(x => x.Id == content.Id); actual.DeleteLink() .ShouldBeDelete() .EndingWith($"libraries/{_libraryId}/books/{_chapter.BookId}/chapters/{_chapter.ChapterNumber}/contents") .ShouldHaveAcceptLanguage(actual.Language); return(this); }
internal static void ShouldHaveLocationHeader(RedirectResult result, int libraryId, int bookId, ChapterContentDto content) { var response = result as RedirectResult; response.Url.Should().NotBeNull(); response.Url.Should().EndWith($"libraries/{libraryId}/books/{bookId}/chapters/{content.ChapterId}/contents/{content.Id}"); }
internal static void ShouldHaveDeletedContent(IDbConnection dbConnection, ChapterContentDto content) { var dbContent = dbConnection.GetChapterContentById(content.Id); dbContent.Should().BeNull("Chapter contnet should be deleted"); }