title: Unit Testing How can I deserialize a JSON object into dynamic object using json-net
body: <p>Using MSTest, when I try to run a test that has a type of dynamic that is a container of a JSON object (from an API Query) I am ment to be able to dereference the JSON elements in the commented out be below, but it fails, where as treating it as an item collection it seems ok.
  If inspect '(jsonResponse.message)' it has a value of  "Hi" - but it wont work in a Unit Test. 
  Why is that?</p>
  
  <p>// <a href="http://www.newtonsoft.com/json/help/html/LINQtoJSON.htm" rel="nofollow noreferrer">http://www.newtonsoft.com/json/help/html/LINQtoJSON.htm</a>
  // <a href="https://stackoverflow.com/questions/4535840/deserialize-json-object-into-dynamic-object-using-json-net">Deserialize json object into dynamic object using Json.net</a></p>
  
  <pre><code>[TestMethod]
  public void DynamicDeserialization()
  {
      dynamic jsonResponse = JsonConvert.DeserializeObject("{\"message\":\"Hi\"}");
      JObject  d = JObject.Parse("{\"message\":\"Hi\"}");
      Assert.IsTrue((string)d["message"]  == "Hi");          // Is ok
  // Assert.IsTrue(jsonResponse.message.ToString() == "Hi"); // is not ok
  }    
  </code></pre>