public async Task Setup() { var author = AuthorBuilder.WithLibrary(LibraryId).Build(); var series = SeriesBuilder.WithLibrary(LibraryId).Build(); var categories = CategoryBuilder.WithLibrary(LibraryId).Build(3); var book = new BookView { Title = RandomData.Name, Authors = new List <AuthorView> { new AuthorView { Id = author.Id } }, SeriesId = series.Id, SeriesIndex = 1, SeriesName = series.Name, Language = RandomData.Locale, Categories = RandomData.PickRandom(categories, 2).Select(c => new CategoryView { Id = c.Id }) }; _response = await Client.PostObject($"/libraries/{LibraryId}/books", book); _bookAssert = BookAssert.WithResponse(_response).InLibrary(LibraryId); }
public async Task Setup() { var authors = AuthorBuilder.WithLibrary(LibraryId).Build(4); var expected = authors.PickRandom(); _response = await Client.DeleteAsync($"/libraries/{LibraryId}/authors/{expected.Id}"); }
public async Task Setup() { AuthorBuilder.WithLibrary(LibraryId).WithBooks(3).WithoutImage().Build(4); _response = await Client.GetAsync($"/libraries/{LibraryId}/authors"); _assert = new PagingAssert <AuthorView>(_response); }
public async Task Setup() { var author = AuthorBuilder.WithLibrary(LibraryId).Build(); _authorId = author.Id; _newImage = RandomData.Bytes; _response = await Client.PutFile($"/libraries/{LibraryId}/authors/{_authorId}/image", _newImage); }
public async Task Setup() { var author = AuthorBuilder.WithLibrary(LibraryId).Build(); author.Name = RandomData.Name; _response = await Client.PutObject($"/libraries/{LibraryId}/authors/{author.Id}", author); }
public async Task Setup() { AuthorBuilder.WithLibrary(LibraryId).WithBooks(3).WithNamePattern("SearchAuthor").Build(5); _response = await Client.GetAsync($"/libraries/{LibraryId}/authors?query=SearchAuthor&pageNumber={1}&pageSize={10}"); _assert = new PagingAssert <AuthorView>(_response); }
public async Task Setup() { AuthorBuilder.WithLibrary(LibraryId).WithBooks(3).Build(20); _response = await Client.GetAsync($"/libraries/{LibraryId}/authors?pageNumber={100}&pageSize={10}"); _assert = new PagingAssert <AuthorView>(_response); }
public async Task Setup() { var authors = AuthorBuilder.WithLibrary(LibraryId).Build(4); _expected = authors.PickRandom(); _response = await Client.GetAsync($"/libraries/{LibraryId}/authors/{_expected.Id}"); _assert = AuthorAssert.WithResponse(_response).InLibrary(LibraryId); }
public async Task Setup() { var authors = AuthorBuilder.WithLibrary(LibraryId).WithBooks(3).WithoutImage().Build(20); _searchedAuthor = authors.PickRandom(); _response = await Client.GetAsync($"/libraries/{LibraryId}/authors?query={_searchedAuthor.Name}"); _assert = new PagingAssert <AuthorView>(_response); }
public async Task Setup() { _author = AuthorBuilder.WithLibrary(LibraryId).Build(); _authorBooks = BookBuilder.WithLibrary(LibraryId).WithAuthor(_author).IsPublic().Build(1); AuthorBuilder.WithLibrary(LibraryId).WithBooks(3).Build(); _response = await Client.GetAsync($"/libraries/{LibraryId}/books?pageNumber=20&pageSize=10&authorId={_author.Id}"); _assert = new PagingAssert <BookView>(_response); }
public async Task Setup() { _categories = CategoryBuilder.WithLibrary(LibraryId).Build(2); _authors = AuthorBuilder.WithLibrary(LibraryId).Build(2); _books = BookBuilder.WithLibrary(LibraryId).WithCategories(_categories).WithAuthors(_authors).IsPublic().Build(12); _response = await Client.GetAsync($"/libraries/{LibraryId}/books?pageNumber=1&pageSize=10&sortby=DateCreated&sort=Ascending"); _assert = new PagingAssert <BookView>(_response); }
public async Task Setup() { _categories = CategoryBuilder.WithLibrary(LibraryId).Build(2); _authors = AuthorBuilder.WithLibrary(LibraryId).Build(2); BookBuilder.WithLibrary(LibraryId).WithCategories(_categories).WithAuthors(_authors).IsPublic().Build(30); _response = await Client.GetAsync($"/libraries/{LibraryId}/books?pageNumber=2&pageSize=10&query=itle"); _assert = new PagingAssert <BookView>(_response); }
public async Task Setup() { var author = AuthorBuilder.WithLibrary(LibraryId).Build(); var book = new BookView { Title = RandomData.Name, Authors = new List <AuthorView> { new AuthorView { Id = author.Id } } }; _response = await Client.PostObject($"/libraries/{-RandomData.Number}/books", book); }
public async Task Setup() { var authors = AuthorBuilder.WithLibrary(LibraryId).WithBooks(3).Build(4); var author = authors.PickRandom(); _expected = new AuthorView { Name = RandomData.Name }; _response = await Client.PutObject($"/libraries/{LibraryId}/authors/{author.Id}", author); _assert = AuthorAssert.WithResponse(_response).InLibrary(LibraryId); }
public async Task Setup() { _library2Builder = Services.GetService <LibraryDataBuilder>(); var library2 = _library2Builder.Build(); var author = AuthorBuilder.WithLibrary(library2.Id).Build(); var book = new BookView { Title = RandomData.Name, Authors = new List <AuthorView> { new AuthorView { Id = author.Id } } }; _response = await Client.PostObject($"/libraries/{LibraryId}/books", book); }
public async Task Setup() { var otherAuthor = AuthorBuilder.WithLibrary(LibraryId).Build(); var newCategories = CategoryBuilder.WithLibrary(LibraryId).Build(3); var otherSeries = SeriesBuilder.WithLibrary(LibraryId).Build(); var books = BookBuilder.WithLibrary(LibraryId) .WithCategories(3) .HavingSeries() .AddToFavorites(AccountId) .AddToRecentReads(AccountId) .Build(1); var selectedBook = books.PickRandom(); _categoriesToUpdate = DatabaseConnection.GetCategoriesByBook(selectedBook.Id).ToList(); _categoriesToUpdate.AddRange(newCategories); var fake = new Faker(); _expected = new BookView { Id = selectedBook.Id, Title = fake.Name.FullName(), Description = fake.Random.Words(5), Copyrights = fake.PickRandom <CopyrightStatuses>().ToDescription(), Language = Helpers.RandomData.Locale, YearPublished = fake.Date.Past().Year, Status = fake.PickRandom <BookStatuses>().ToDescription(), IsPublic = fake.Random.Bool(), Authors = new List <AuthorView> { new AuthorView { Id = otherAuthor.Id, Name = otherAuthor.Name } }, SeriesId = otherSeries.Id, IsPublished = fake.Random.Bool(), Categories = _categoriesToUpdate.Select(c => new CategoryView { Id = c.Id }) }; _response = await Client.PutObject($"/libraries/{LibraryId}/books/{selectedBook.Id}", _expected); _bookAssert = BookAssert.WithResponse(_response).InLibrary(LibraryId); }
public async Task Setup() { _authors = AuthorBuilder.WithLibrary(LibraryId).Build(3); _categories = CategoryBuilder.WithLibrary(LibraryId).Build(3); var books = BookBuilder.WithLibrary(LibraryId) .HavingSeries() .WithCategories(_categories) .WithAuthors(_authors) .WithContents(3) .WithPages() .Build(4); _expected = books.PickRandom(); _response = await Client.GetAsync($"/libraries/{LibraryId}/books/{_expected.Id}"); _assert = BookAssert.WithResponse(_response).InLibrary(LibraryId); }
public async Task Setup() { var author = AuthorBuilder.WithLibrary(LibraryId).Build(); var book = new BookView { Title = new Faker().Random.String(), Authors = new List <AuthorView> { new AuthorView { Id = author.Id } }, Categories = new CategoryView[] { new CategoryView { Id = -RandomData.Number } } }; _response = await Client.PostObject($"/libraries/{LibraryId}/books", book); }
public async Task Setup() { _author = AuthorBuilder.WithLibrary(LibraryId).Build(); var books = BookBuilder.WithLibrary(LibraryId).WithAuthor(_author).Build(1); _bookToUpdate = books.PickRandom(); var book = new BookView { Title = RandomData.Text, Authors = new List <AuthorView> { new AuthorView { Id = -RandomData.Number } } }; _response = await Client.PutObject($"/libraries/{LibraryId}/books/{_bookToUpdate.Id}", book); }
public async Task Setup() { var author = AuthorBuilder.WithLibrary(LibraryId).Build(); _expected = new BookView { Title = RandomData.Name, Description = RandomData.Words(10), Authors = new List <AuthorView> { new AuthorView { Id = author.Id } }, Language = RandomData.Locale }; _response = await Client.PutObject($"/libraries/{LibraryId}/books/{_expected.Id}", _expected); _bookAssert = BookAssert.WithResponse(_response).InLibrary(LibraryId); }
public async Task Setup() { _library2Builder = Services.GetService <LibraryDataBuilder>(); var library2 = _library2Builder.Build(); var category = CategoryBuilder.WithLibrary(library2.Id).Build(); var author = AuthorBuilder.WithLibrary(LibraryId).Build(); var book = new BookView { Title = new Faker().Random.String(), Authors = new List <AuthorView> { new AuthorView { Id = author.Id } }, Categories = new CategoryView[] { new CategoryView { Id = category.Id } } }; _response = await Client.PostObject($"/libraries/{LibraryId}/books", book); }
public async Task Setup() { _library2Builder = Services.GetService <LibraryDataBuilder>(); var library2 = _library2Builder.Build(); var author2 = AuthorBuilder.WithLibrary(library2.Id).Build(); _author = AuthorBuilder.WithLibrary(LibraryId).Build(); var books = BookBuilder.WithLibrary(LibraryId).WithAuthor(_author).Build(1); _bookToUpdate = books.PickRandom(); var book = new BookView { Title = RandomData.Text, Authors = new List <AuthorView> { new AuthorView { Id = author2.Id } } }; _response = await Client.PutObject($"/libraries/{LibraryId}/books/{_bookToUpdate.Id}", book); }