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); }
public void ParseJsonNonGeneric_EmptyString() { var result = JsonEntity.ParseJson(string.Empty, typeof(UserResult)); Assert.IsNull(result); }
public void ParseJsonNonGeneric_Null() { Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJson(null, typeof(UserResult))); }
public void ParseJsonNonGeneric_InvalidJson() { var ex = Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJson("this is not JSON", typeof(UserResult))); Assert.IsNotNull(ex.InnerException); }
public void ParseJson_EmptyString() { var result = JsonEntity.ParseJson <UserResult>(string.Empty); Assert.IsNull(result); }
public void ParseJson_Null() { Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJson <UserResult>(null)); }
public void ParseJson_InvalidJson() { var ex = Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJson <UserResult>("this is not JSON")); Assert.IsNotNull(ex.InnerException); }