コード例 #1
0
        public void Test_GetObjectList_Null(string json)
        {
            IObjectReader reader = GetReader(json);
            IReadOnlyList <IObjectReader> list = reader.GetObjectList("a");

            Assert.That(list, Is.Null);
        }
コード例 #2
0
        public void Test_GetObjectList_SingleNull(string json)
        {
            IObjectReader reader = GetReader(json);
            IReadOnlyList <IObjectReader> list = reader.GetObjectList("a");

            Assert.That(list, Is.Not.Null);
            Assert.That(list, Has.Count.EqualTo(1));
            Assert.That(list [0], Is.Null);
        }
コード例 #3
0
 /// <summary>
 /// Read a collection of child objects.
 /// Call when expecting zero to many objects in an array.
 /// </summary>
 public IReadOnlyList <IObjectReader> GetObjectList(string key)
 {
     try
     {
         return(_inner.GetObjectList(key));
     }
     catch
     {
         return(null);
     }
 }
コード例 #4
0
        public void Test_GetObjectList_Values(string json)
        {
            IObjectReader reader = GetReader(json);
            IReadOnlyList <IObjectReader> list = reader.GetObjectList("a");

            Assert.That(list, Is.Not.Null);
            Assert.That(list, Has.Count.EqualTo(2));
            Assert.That(list [0], Is.Not.Null);
            Assert.That(list [1], Is.Not.Null);
            Assert.That(list [0].GetInt("b"), Is.EqualTo(1));
            Assert.That(list [1].GetInt("c"), Is.EqualTo(2));
        }
コード例 #5
0
        public void Test_GetObjectList_SameInstance(string json)
        {
            IObjectReader reader = GetReader(json);

            Assert.That(reader.GetObjectList("a"), Is.SameAs(reader.GetObjectList("a")));
        }