コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        internal void ShouldHaveContentLink(ChapterContentDto content)
        {
            var actual = _chapter.Contents.Single(x => x.Id == content.Id);

            actual.SelfLink()
            .ShouldBeGet()
            .ShouldHaveAcceptLanguage(content.Language);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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}");
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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}");
        }
コード例 #9
0
        internal static void ShouldHaveDeletedContent(IDbConnection dbConnection, ChapterContentDto content)
        {
            var dbContent = dbConnection.GetChapterContentById(content.Id);

            dbContent.Should().BeNull("Chapter contnet should be deleted");
        }