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 series = SeriesBuilder.WithLibrary(LibraryId).Build(4); var expected = series.PickRandom(); _response = await Client.DeleteAsync($"/libraries/{LibraryId}/series/{expected.Id}"); }
public async Task Setup() { var series = SeriesBuilder.WithLibrary(LibraryId).Build(); _seriesId = series.Id; _newImage = RandomData.Bytes; _response = await Client.PutFile($"/libraries/{LibraryId}/series/{series.Id}/image", _newImage); }
public async Task Setup() { var Series = SeriesBuilder.WithLibrary(LibraryId).WithBooks(3).WithoutImage().Build(20); _response = await Client.GetAsync($"/libraries/{LibraryId}/series?query={_searchedSeries}"); _assert = new PagingAssert <SeriesView>(_response); }
public async Task Setup() { SeriesBuilder.WithLibrary(LibraryId).WithBooks(3).Build(4); _response = await Client.GetAsync($"/libraries/{LibraryId}/series?pageNumber=1&pageSize=10"); _assert = new PagingAssert <SeriesView>(_response); }
public async Task Setup() { SeriesBuilder.WithLibrary(LibraryId).WithBooks(3).WithNamePattern("SearchSeries").Build(50); _response = await Client.GetAsync($"/libraries/{LibraryId}/series?query=SearchSeries&pageNumber=5&pageSize=10"); _assert = new PagingAssert <SeriesView>(_response); }
public async Task Setup() { var series = SeriesBuilder.WithLibrary(LibraryId).Build(); series.Name = RandomData.Name; _response = await Client.PutObject($"/libraries/{LibraryId}/series/{series.Id}", series); }
public async Task Setup() { var series = SeriesBuilder.WithLibrary(LibraryId).Build(4); _expected = series.PickRandom(); _response = await Client.GetAsync($"/libraries/{LibraryId}/series/{_expected.Id}"); _assert = SeriesAssert.WithResponse(_response).InLibrary(LibraryId); }
public async Task Setup() { _series = SeriesBuilder.WithLibrary(LibraryId).Build(); _SeriesBooks = BookBuilder.WithLibrary(LibraryId).WithSeries(_series).IsPublic().Build(25); SeriesBuilder.WithLibrary(LibraryId).WithBooks(3).Build(); _response = await Client.GetAsync($"/libraries/{LibraryId}/books?pageNumber=4&pageSize=10&seriesid={_series.Id}"); _assert = new PagingAssert <BookView>(_response); }
public async Task Setup() { _series = SeriesBuilder.WithLibrary(LibraryId).Build(); var books = BookBuilder.WithLibrary(LibraryId).WithSeries(_series).Build(1); _bookToUpdate = books.PickRandom(); var book = new BookView { Title = RandomData.Text, SeriesId = -RandomData.Number }; _response = await Client.PutObject($"/libraries/{LibraryId}/books/{_bookToUpdate.Id}", book); }
public async Task Setup() { _series = SeriesBuilder.WithLibrary(LibraryId).Build(); _seriesBooks = BookBuilder.WithLibrary(LibraryId) .WithSeries(_series) .IsPublic() .AddToFavorites(AccountId) .Build(5); SeriesBuilder.WithLibrary(LibraryId).WithBooks(3).Build(); _response = await Client.GetAsync($"/libraries/{LibraryId}/books?pageNumber=1&pageSize=10&favorite=true"); _assert = new PagingAssert <BookView>(_response); }
public async Task Setup() { var series = SeriesBuilder.WithLibrary(LibraryId).WithBooks(3).Build(4); var selectedSeries = series.PickRandom(); _expected = new SeriesView { Name = RandomData.Name }; _response = await Client.PutObject($"/libraries/{LibraryId}/series/{selectedSeries.Id}", _expected); _assert = SeriesAssert.WithResponse(_response).InLibrary(LibraryId); }
public async Task Setup() { _library2Builder = Services.GetService <LibraryDataBuilder>(); var library2 = _library2Builder.Build(); var series = SeriesBuilder.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 } }, SeriesId = series.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() { _library2Builder = Services.GetService <LibraryDataBuilder>(); var library2 = _library2Builder.Build(); var series2 = SeriesBuilder.WithLibrary(library2.Id).Build(); _series = SeriesBuilder.WithLibrary(LibraryId).Build(); var books = BookBuilder.WithLibrary(LibraryId).WithSeries(_series).Build(1); _bookToUpdate = books.PickRandom(); var book = new BookView { Title = RandomData.Text, SeriesId = series2.Id }; _response = await Client.PutObject($"/libraries/{LibraryId}/books/{_bookToUpdate.Id}", book); }