title: How to create a mock HttpWebRequest and HttpWebResponse object
body: <p>How to create mock HttpWebRequest and HttpWebResponse object
  I am trying to unittest the following piece of code</p>
  
  <pre><code>HttpWebrequest request;   
  
  if (null != request)
  {                         
      var response = (HttpWebResponse)request.GetResponse();
      using (var sr = new StreamReader(response.GetResponseStream()))
      {
          jsonResult = sr.ReadToEnd();
      }
  
      var myRecords = SerializationHelper.Deserialize&lt;Records&gt;(jsonResult);
  }
  </code></pre>