Esempio n. 1
0
        public void ParseJsonArrayThenToJson(string filename, Type resultType)
        {
            var json       = TestFileProvider.ReadText(filename);
            var results    = JsonEntity.ParseJsonArray(json, resultType);
            var serialized = "[" + string.Join(",", results.Select(r => r.ToJson())) + "]";

            var expected = NormalizeJson(json);
            var actual   = NormalizeJson(serialized);

            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public void ParseJsonArrayNonGeneric_EmptyString()
        {
            var result = JsonEntity.ParseJsonArray(string.Empty, typeof(UserResult));

            Assert.IsNull(result);
        }
Esempio n. 3
0
 public void ParseJsonArrayNonGeneric_Null()
 {
     Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJsonArray(null, typeof(UserResult)));
 }
Esempio n. 4
0
        public void ParseJsonArrayNonGeneric_InvalidJson()
        {
            var ex = Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJsonArray("this is not JSON", typeof(UserResult)));

            Assert.IsNotNull(ex.InnerException);
        }
Esempio n. 5
0
        public void ParseJsonArray_EmptyString()
        {
            var result = JsonEntity.ParseJsonArray <UserResult>(string.Empty);

            Assert.IsNull(result);
        }
Esempio n. 6
0
 public void ParseJsonArray_Null()
 {
     Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJsonArray <UserResult>(null));
 }
Esempio n. 7
0
        public void ParseJsonArray_InvalidJson()
        {
            var ex = Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJsonArray <UserResult>("this is not JSON"));

            Assert.IsNotNull(ex.InnerException);
        }