Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8175267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:43:03+00:00 2026-06-06T22:43:03+00:00

I am trying to test some async methods involving the HttpClient work with vs

  • 0

I am trying to test some async methods involving the HttpClient work with vs 2012 express for win 8 and it’s test framework. No matter how I try I always get the same exception.

For example this test code:

[TestMethod]
public async Task Connect()
{
    HttpClient client = new HttpClient();
    string reply = await client.GetStringAsync("http://google.com");
    Assert.AreNotEqual(0, reply.Length);
}

Which should probably work considering this: http://www.richard-banks.org/2012/03/how-to-unit-test-async-methods-with.html

Throws

System.Net.WebException: The remote name could not be resolved: 'google.com'

The same code works just fine when called from an actual program (not a test case).
Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:43:05+00:00Added an answer on June 6, 2026 at 10:43 pm

    Please refer to my comments and I can include this as an answer to your question.

    “Are you are using the metro style Unit Testing template? If yes you need to enable the Internet Client (I think) in the app manifest file -> capabilities to allow this behaviour?. Also since you are testing an external call, this is not a Unit Test. It is more of an integration test.“

    I have used exactly the same code you have and I get exactly the same error. As I said if you just tick the the Package.appxmanifest -> Capabilities – > Internet (Client) check box, you test should pass.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to test some mailers with rspec but deliveries are always empty. Here
I am trying to test some methods in my models. For example, in my
I'm trying to test out some different methods of drawing to a Canvas, without
I am trying to test some custom controls with the UI Automated framework. One
I am trying to test some other Python code repeatedly, using all possible combinations
I am trying to test some of these code here http://ha.ckers.org/xss.html on my code.
I am trying to test some exceptions in my project and one of the
I'm learning Python and trying to test some rest web_service applications. From the below
I am trying to unit test some code, and I need to to replace
I am trying to test out some Dapper stuff using LinqPad. Dapper needs a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.