Merge pull request #274 from iainlane/master
[mono.git] / mcs / class / System.Json / Test / System.Json / JsonValueTest.cs
1 //
2 // JsonValueTest.cs: Tests for JSonValue
3 //
4 // Copyright 2011 Xamarin, Inc.
5 //
6 // Authors:
7 //   Miguel de Icaza
8 //
9 using NUnit.Framework;
10 using System;
11 using System.IO;
12 using System.Text;
13 using System.Json;
14
15 namespace MonoTests.System
16 {
17         [TestFixture]
18         public class JsonValueTests {
19                 // Tests that a trailing comma is allowed in dictionary definitions
20                 // Test that we correctly serialize JsonArray with null elements.
21                 [Test]
22                 public void ToStringOnJsonArrayWithNulls () {
23                         var j = JsonValue.Load (new StringReader ("[1,2,3,null]"));
24                         Assert.AreEqual (4, j.Count, "itemcount");
25                         Assert.AreEqual (JsonType.Array, j.JsonType, "type");
26                         var str = j.ToString ();
27                         Assert.AreEqual ("[1,2,3,null]", str);
28                 }
29         }
30 }