예제 #1
0
 public BingSearcherService()
 {
     _client = new CustomSearchClient(
         new ApiKeyServiceClientCredentials(
             "4382be3ef124422b85d9d1e95784621b"
             ));
 }
        public void CustomSearch()
        {
            using (MockContext context = MockContext.Start(this.GetType()))
            {
                HttpMockServer.Initialize(this.GetType(), "CustomSearch");

                ICustomSearchClient client = new CustomSearchClient(new ApiKeyServiceClientCredentials(SubscriptionKey), HttpMockServer.CreateInstance());
                var resp = client.CustomInstance.SearchAsync(query: "tom cruise", customConfig: "0").Result;

                Assert.NotNull(resp);
                Assert.NotNull(resp.WebPages);
                Assert.NotNull(resp.WebPages.WebSearchUrl);

                Assert.NotNull(resp.WebPages.Value);
                Assert.NotNull(resp.WebPages.Value[0].DisplayUrl);
            }
        }