public async Task ReturnsNullIfNotFound() { var authorId = -1; var books = await BooksEndpoint.GetListByAuthorId(authorId); Assert.Null(books); }
public async Task ReturnsNullIfNotFound() { var isbn = "test"; var bookId = await BooksEndpoint.GetBookIdForIsbn(isbn); Assert.Null(bookId); }
public async Task ReturnsNullIfNotFound() { // Hopefully no one will write a book with this title in the future... var book = await BooksEndpoint.GetByTitle("asasdasd123123123"); Assert.Null(book); }
public async Task ReturnsABookId() { var isbn = "0765326353"; var bookId = await BooksEndpoint.GetBookIdForIsbn(isbn); Assert.NotNull(bookId); Assert.Equal(7235533, bookId); }
public async Task ReturnsResults() { var books = await BooksEndpoint.Search("stormlight"); Assert.NotNull(books); Assert.NotEmpty(books.List); Assert.True(books.Pagination.TotalItems > 0); }
public async Task ReturnsASecondPage() { var books = await BooksEndpoint.Search("stormlight", page : 2); Assert.NotNull(books); Assert.NotEmpty(books.List); Assert.True(books.Pagination.TotalItems > 0); Assert.True(books.Pagination.Start > 1); }
public async Task OnlyReturnsStatsForFoundIsbns() { var isbns = new List <string> { "0765326353", "missing", "9780765326362" }; var reviewStats = await BooksEndpoint.GetReviewStatsForIsbns(isbns); Assert.NotNull(reviewStats); Assert.Equal(2, reviewStats.Count); }
public async Task GetsTheAverageRating() { var books = await BooksEndpoint.Search("stormlight", page : 1); Assert.NotNull(books); Assert.NotEmpty(books.List); Assert.True(books.Pagination.TotalItems > 0); Assert.True(books.Pagination.Start > 1); Assert.True(books.List[0].AverageRating > 0); }
public async Task ReturnsBooks() { var authorId = 38550; var books = await BooksEndpoint.GetListByAuthorId(authorId); Assert.NotNull(books); Assert.NotEmpty(books.List); Assert.True(books.Pagination.TotalItems > 0); Assert.Contains(books.List.First().Authors, x => x.Id == authorId); }
public async Task ReturnsABook() { var bookId = 7235533; var isbn = "0765326353"; var book = await BooksEndpoint.GetByBookId(bookId); Assert.NotNull(book); Assert.Equal(book.Id, bookId); Assert.Equal(book.Isbn, isbn); }
public async Task ReturnsASecondPage() { var authorId = 38550; var books = await BooksEndpoint.GetListByAuthorId(authorId, page : 2); Assert.NotNull(books); Assert.NotEmpty(books.List); Assert.True(books.Pagination.TotalItems > 0); Assert.True(books.Pagination.Start == 31); }
public async Task ReturnsABook() { var title = "The Way of Kings"; var bookId = 7235533; var isbn = "0765326353"; var book = await BooksEndpoint.GetByTitle(title); Assert.NotNull(book); Assert.Equal(book.Id, bookId); Assert.Equal(book.Isbn, isbn); }
public UnauthorizedGoodreadsClient(string apiKey, string apiSecret, string accessToken, string accessSecret) : base(apiKey, apiSecret, accessToken, accessSecret) { Authors = new AuthorsEnpoint(_connection); Books = new BooksEndpoint(_connection); Shelves = new ShelvesEndpoint(_connection); Users = new UsersEndpoint(_connection); Reviews = new ReviewsEndpoint(_connection); Series = new SeriesEndpoint(_connection); Events = new EventsEndpoint(_connection); Groups = new GroupsEndpoint(_connection); UserStatuses = new UserStatusesEndpoint(_connection); ReadStatuses = new ReadStatusesEndpoint(_connection); Comments = new CommentsEndpoint(_connection); Topics = new TopicsEndpoint(_connection); }
public async Task HandlesMissingIsbns() { var isbns = new List <string> { "0765326353", "missing", "9780765326362" }; var expectedBookIds = new List <int?> { 7235533, null, 17332218 }; var actualBookIds = await BooksEndpoint.GetBookIdsForIsbns(isbns); Assert.NotNull(actualBookIds); Assert.Equal(actualBookIds.Count, isbns.Count); Assert.Equal(actualBookIds.Count, expectedBookIds.Count); for (var i = 0; i < actualBookIds.Count; i++) { Assert.Equal(actualBookIds[i], expectedBookIds[i]); } }
public async Task HandlesMissingBookIds() { var bookIds = new List <long> { 7235533, int.MaxValue, 17332218 }; var expectedWorkIds = new List <long?> { 8134945, null, 16482835 }; var actualWorkIds = await BooksEndpoint.GetWorkIdsForBookIds(bookIds); Assert.NotNull(actualWorkIds); Assert.Equal(actualWorkIds.Count, expectedWorkIds.Count); Assert.Equal(actualWorkIds.Count, expectedWorkIds.Count); for (var i = 0; i < actualWorkIds.Count; i++) { Assert.Equal(actualWorkIds[i], expectedWorkIds[i]); } }
public OAuthGoodreadsClient(string apiKey, string apiSecret, string accessToken, string accessSecret) : base(apiKey, apiSecret, accessToken, accessSecret) { Authors = new AuthorsEnpoint(_connection); AuthorsFollowing = new AuthorsFollowingEndpoint(_connection); Books = new BooksEndpoint(_connection); Comments = new CommentsEndpoint(_connection); Events = new EventsEndpoint(_connection); Followers = new FollowersEndpoint(_connection); Friends = new FriendsEndpoint(_connection); Groups = new GroupsEndpoint(_connection); Notifications = new NotificationsEndpoint(_connection); OwnedBooks = new OwnedBooksEndpoint(_connection); Quotes = new QuotesEndpoint(_connection); ReadStatuses = new ReadStatusesEndpoint(_connection); Recommendations = new RecommendationsEndpoint(_connection); Reviews = new ReviewsEndpoint(_connection); Series = new SeriesEndpoint(_connection); Shelves = new ShelvesEndpoint(_connection); Topics = new TopicsEndpoint(_connection); Updates = new UpdatesEndpoint(_connection); Users = new UsersEndpoint(_connection); UserStatuses = new UserStatusesEndpoint(_connection); }
public async Task ReturnsNullIfNotFound() { var book = await BooksEndpoint.GetByBookId(int.MaxValue); Assert.Null(book); }
public async Task ReturnsNullIfNotFound() { var book = await BooksEndpoint.GetByIsbn("test"); Assert.Null(book); }