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); }
public void ParseJsonArrayNonGeneric_EmptyString() { var result = JsonEntity.ParseJsonArray(string.Empty, typeof(UserResult)); Assert.IsNull(result); }
public void ParseJsonArrayNonGeneric_Null() { Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJsonArray(null, typeof(UserResult))); }
public void ParseJsonArrayNonGeneric_InvalidJson() { var ex = Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJsonArray("this is not JSON", typeof(UserResult))); Assert.IsNotNull(ex.InnerException); }
public void ParseJsonArray_EmptyString() { var result = JsonEntity.ParseJsonArray <UserResult>(string.Empty); Assert.IsNull(result); }
public void ParseJsonArray_Null() { Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJsonArray <UserResult>(null)); }
public void ParseJsonArray_InvalidJson() { var ex = Assert.Throws <GogsKitResultParseException>(() => JsonEntity.ParseJsonArray <UserResult>("this is not JSON")); Assert.IsNotNull(ex.InnerException); }