title: Load JSON string to HttpRequestMessage
body: <p>I'm writing some tests for my WebAPI web service and cannot figure out how to send JSON to my service method in the test.</p>
  
  <pre><code>ScheduleRequest sr = new ScheduleRequest();
  sr.Months = null;
  sr.States = null;
  sr.Zip = null;
  sr.Miles = null;
  sr.PCodes = null;
  sr.PageStart = 1;
  sr.PageLimit = 10;
  
  HttpRequestMessage m = new HttpRequestMessage();
  string sr_ = JsonConvert.SerializeObject(sr);
  
  // How do I load it into the HttpRequestMessage???
  // m.Content. = sr_;
  var controller = new ShoppingCartController();
  
  // Call the controlelr method and test if the return data is correct.
  EventSyncResponse res = (EventSyncResponse)controller.CourseSchedule(m);
  </code></pre>
  
  <p>Am I doing this correctly, too?</p>
  
  <p><strong>Controller Code:</strong></p>
  
  <pre><code>public object CourseSchedule(ScheduleRequest request)
  {
      try
      {
          var result = cart.GetCourseSchedule(request);
          return Ok(result);
      } 
      catch (Exception ex)
      {
          if (ex.Message.StartsWith(@"ORA-20001"))
          {
              return Ok(new ParticipantResponse { FirstName = "No record found" });
          }
          throw ex;
      }
  }
  </code></pre>