コード例 #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);
        }