title: How Can We Create Unit Tests For Webapi With 3rd Party API's
body: <p>I am using Nunit for creating unit tests. I am having webapi project and using some third party api for Below is one of blocks of code i am using .</p>
  
  <p>In Below function you can see i am returning json data returned by facebook graph api in String Format . As for Unit Test Assert IsEqual Check my both comparing objects will be using data from same api then Do I need to match them or Do I need to Do Testing for This type of project . </p>
  
  <pre><code>public  string getfriends(string accesstoken)
          {
              string retVal = "";
              string url = API_BaseUrl + "/me/invitable_friends?&amp;access_token=" + accesstoken;
              System.Net.HttpWebRequest request = System.Net.WebRequest.Create(url) as System.Net.HttpWebRequest;
              System.Net.HttpWebResponse response = null;
              try
              {
                  using (response = request.GetResponse() as System.Net.HttpWebResponse)
                  {
                      System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());
                      retVal = reader.ReadToEnd();
                  }
              }
              catch (Exception ex)
              {
  
              }
              return retVal;
          }
  </code></pre>