public void SerializeNullExpandoObject()
    {
      ExpandoContainer d = new ExpandoContainer();

      string json = JsonConvert.SerializeObject(d, Formatting.Indented);

      Assert.AreEqual(@"{
  ""Before"": null,
  ""Expando"": null,
  ""After"": null
}", json);
    }
    public void SerializeExpandoObject()
    {
      ExpandoContainer d = new ExpandoContainer
        {
          Before = "Before!",
          Expando = new ExpandoObject(),
          After = "After!"
        };

      dynamic o = d.Expando;

      o.String = "String!";
      o.Integer = 234;
      o.Float = 1.23d;
      o.List = new List<string> {"First", "Second", "Third"};
      o.Object = new Dictionary<string, object>
        {
          {"First", 1}
        };

      string json = JsonConvert.SerializeObject(d, Formatting.Indented);

      Assert.AreEqual(@"{
  ""Before"": ""Before!"",
  ""Expando"": {
    ""String"": ""String!"",
    ""Integer"": 234,
    ""Float"": 1.23,
    ""List"": [
      ""First"",
      ""Second"",
      ""Third""
    ],
    ""Object"": {
      ""First"": 1
    }
  },
  ""After"": ""After!""
}", json);
    }