Esempio n. 1
0
        public async Task Setup()
        {
            _book     = BookBuilder.WithLibrary(LibraryId).WithContents(5).Build();
            _expected = BookBuilder.Contents.PickRandom();
            _response = await Client.GetAsync($"/libraries/{LibraryId}/books/{_book.Id}/contents", _expected.Language, _expected.MimeType);

            _assert = new BookContentAssert(_response, LibraryId);
        }
        public async Task Setup()
        {
            _book = BookBuilder.WithLibrary(LibraryId).WithContents(2).Build();
            _file = BookBuilder.Contents.PickRandom();

            _expected = new Faker().Image.Random.Bytes(50);

            _response = await Client.PutFile($"/libraries/{LibraryId}/books/{_book.Id}/contents", _expected, _file.Language, _file.MimeType);

            _assert = new BookContentAssert(_response, LibraryId);
        }
        public void ShouldNotHaveDeletedOtherBookFiles()
        {
            foreach (var item in BookBuilder.Contents)
            {
                if (item.Id == _expected.Id)
                {
                    continue;
                }

                BookContentAssert.ShouldHaveBookContent(item.BookId, item.Language, item.MimeType, DatabaseConnection);
            }
        }
Esempio n. 4
0
        public async Task Setup()
        {
            _mimeType = RandomData.MimeType;
            _locale   = RandomData.Locale;

            _book     = BookBuilder.WithLibrary(LibraryId).Build();
            _contents = RandomData.Bytes;

            _response = await Client.PutFile($"/libraries/{LibraryId}/books/{_book.Id}/contents", _contents, _locale, _mimeType);

            _assert = new BookContentAssert(_response, LibraryId);
        }
        public async Task Setup()
        {
            _newMimeType = "text/markdown";

            _book = BookBuilder.WithLibrary(LibraryId).WithContents(2, "application/pdf").Build();
            _file = BookBuilder.Contents.PickRandom();

            _contents = RandomData.Bytes;

            _response = await Client.PutFile($"/libraries/{LibraryId}/books/{_book.Id}/contents", _contents, _file.Language, _newMimeType);

            _assert = new BookContentAssert(_response, LibraryId);
        }
        public async Task Setup()
        {
            _newLanguage = RandomData.Locale;

            _book = BookBuilder.WithLibrary(LibraryId).WithContents(2).WithContentLanguage($"{_newLanguage}_old").Build();
            _file = BookBuilder.Contents.PickRandom();

            _contents = new Faker().Image.Random.Bytes(50);

            _response = await Client.PutFile($"/libraries/{LibraryId}/books/{_book.Id}/contents", _contents, _newLanguage, _file.MimeType);

            _assert = new BookContentAssert(_response, LibraryId);
        }
 public void ShouldHaveDeletedBookFile()
 {
     BookContentAssert.ShouldNotHaveBookContent(_expected.BookId, _expected.Language, _expected.MimeType, DatabaseConnection);
 }