public void TestPropertyCounter() { JObject jsonObjects = JObject.Parse(JsonScripts.TestJson); string[] propertiesToCount = { "x", "y", "z" }; int numberOfMatchingProperties = JsonUtil.CountProperties(jsonObjects, propertiesToCount); Assert.AreEqual(18, numberOfMatchingProperties); }
public void TestCollapseProperties() { JObject jsonObjects = JObject.Parse(JsonScripts.TestJson); var propertiesToCollapse = new List <string>() { "config" }; JsonUtil.CollapseJsonProperties(jsonObjects, propertiesToCollapse); int numberOfProperties = JsonUtil.CountProperties(jsonObjects); Assert.AreEqual(19, numberOfProperties); }
public void TestRemoveProperties() { JObject jsonObjects = JObject.Parse(JsonScripts.TestJson); var propertiesToRemove = new List <string>() { "x", "y", "z", "width", "height", "id" }; JsonUtil.RemoveJsonProperties(jsonObjects, propertiesToRemove); int numberOfProperties = JsonUtil.CountProperties(jsonObjects); Assert.AreEqual(13, numberOfProperties); }