public async Task GetsRandomArticles()
 {
     var client = new WikimediaClient(USER_CLIENT, 5);
     var response = await client.GetMaxRandomArticles();
     Assert.IsNotEmpty(response.Pages);
 }
 static async Task InsertRandomDocumentsIntoDatabase(WikimediaClient client, IMongoCollection<BsonDocument> collection)
 {
     var response = await client.GetMaxRandomArticles();
     var updates = response.Pages.Values.Select(page => {
         var doc = DocumentFromPage(page);
         return collection.ReplaceOneAsync(
             Builders<BsonDocument>.Filter.Eq(d => d["PageId"], page.PageId), doc,
             new UpdateOptions { IsUpsert = true });
     });
     await Task.WhenAll(updates);
 }
 public async Task QueriesMaxNumberOfRandomArticles()
 {
     var httpClient = new Mock<IHttpClient>(MockBehavior.Strict);
     var client = new WikimediaClient(httpClient.Object, "Foo", 5);
     var expectedUrl = client.BaseQueryUrl + "&generator=random&grnnamespace=0&grnlimit=max";
     httpClient.Setup(c => c.Get(expectedUrl, "Foo")).ReturnsAsync("{'query':{}}");
     var response = await client.GetMaxRandomArticles();
     Assert.NotNull(response);
 }