public async Task ReturnsNullIfNotFound() { var authorId = -1; var author = await AuthorsClient.GetByAuthorId(authorId); Assert.Null(author); }
public async Task ReturnsNullIfNotFound() { var authorName = Guid.NewGuid().ToString().Replace("-", string.Empty); var actualAuthorId = await AuthorsClient.GetAuthorIdByName(authorName); Assert.Null(actualAuthorId); }
/// <summary> /// Initializes a new instance of the <see cref="GoodreadsClient"/> class. /// Use this constructor if you already have OAuth permissions for the user. /// </summary> /// <param name="apiKey">Your Goodreads API key.</param> /// <param name="apiSecret">Your Goodreads API secret.</param> /// <param name="accessToken">The user's OAuth access token.</param> /// <param name="accessSecret">The user's OAuth access secret.</param> public GoodreadsClient(string apiKey, string apiSecret, string accessToken, string accessSecret) { var client = new RestClient(new Uri(GoodreadsUrl)) { UserAgent = "goodreads-dotnet" }; client.AddDefaultParameter("key", apiKey, ParameterType.QueryString); client.AddDefaultParameter("format", "xml", ParameterType.QueryString); var apiCredentials = new ApiCredentials(client, apiKey, apiSecret, accessToken, accessSecret); // Setup the OAuth authenticator if they have passed on the appropriate tokens if (!string.IsNullOrWhiteSpace(accessToken) && !string.IsNullOrWhiteSpace(accessSecret)) { client.Authenticator = OAuth1Authenticator.ForProtectedResource( apiKey, apiSecret, accessToken, accessSecret); } Connection = new Connection(client, apiCredentials); Authors = new AuthorsClient(Connection); Books = new BooksClient(Connection); Shelves = new ShelvesClient(Connection); Users = new UsersClient(Connection); Reviews = new ReviewsClient(Connection); Series = new SeriesClient(Connection); }
public async Task ReturnsAnAuthor() { var authorId = 38550; var author = await AuthorsClient.GetByAuthorId(authorId); Assert.NotNull(author); Assert.Equal(author.Id, authorId); }
public async Task ReturnsAnAuthorId() { var authorName = "Brandon Sanderson"; var expectedAuthorId = 38550; var actualAuthorId = await AuthorsClient.GetAuthorIdByName(authorName); Assert.NotNull(actualAuthorId); Assert.Equal(actualAuthorId, expectedAuthorId); }
private void button1_Click(object sender, EventArgs e) { progressBar1.Value = 0; AuthorsClient authorsClient = new AuthorsClient(); authorsClient.GetauthorsCompleted+=new EventHandler<GetauthorsCompletedEventArgs>(authorsClient_GetauthorsCompleted); authorsClient.GetauthorsAsync(); progressBar1.Minimum = 0; progressBar1.Maximum = 10; progressBar1.Step = 1; for (int i = 0; i < 10; i++) { Thread.Sleep(1000); progressBar1.PerformStep(); } label1.Visible = true; label1.Text = "Bất Đồng bô: progressbar chạy cùng lúc khi computer đang lấy thông tin author"; }
private void button2_Click(object sender, EventArgs e) { progressBar1.Value = 0; AuthorsClient AuthorClient = new AuthorsClient(); MessageBox.Show("Tên Thành Viên Nhóm : " + AuthorClient.Getauthors().GroupName + "\nTên Project: " + AuthorClient.Getauthors().ProjectName +"\nChu ý progressbar, sau khi click ok progressbar sẽ chạy!"); progressBar1.Minimum = 0; progressBar1.Maximum = 7; progressBar1.Step = 1; for (int i = 0; i < 7; i++) { Thread.Sleep(7000); progressBar1.PerformStep(); } label1.Visible = true; label1.Text = "Đồng bộ: progressbar chay sau khi hoan tất messageshow"; }