示例#1
0
        public void ParseJsonThenToJson(string filename, Type resultType)
        {
            var json       = TestFileProvider.ReadText(filename);
            var result     = JsonEntity.ParseJson(json, resultType);
            var serialized = result.ToJson();

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

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void ParseJsonNonGeneric_EmptyString()
        {
            var result = JsonEntity.ParseJson(string.Empty, typeof(UserResult));

            Assert.IsNull(result);
        }
示例#3
0
 public void ParseJsonNonGeneric_Null()
 {
     Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJson(null, typeof(UserResult)));
 }
示例#4
0
        public void ParseJsonNonGeneric_InvalidJson()
        {
            var ex = Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJson("this is not JSON", typeof(UserResult)));

            Assert.IsNotNull(ex.InnerException);
        }
示例#5
0
        public void ParseJson_EmptyString()
        {
            var result = JsonEntity.ParseJson <UserResult>(string.Empty);

            Assert.IsNull(result);
        }
示例#6
0
 public void ParseJson_Null()
 {
     Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJson <UserResult>(null));
 }
示例#7
0
        public void ParseJson_InvalidJson()
        {
            var ex = Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJson <UserResult>("this is not JSON"));

            Assert.IsNotNull(ex.InnerException);
        }