public void ValidItemOrNull_ReturnsNull_IfItIsInValid() { var items = new JToken[] { null, new JArray(), new JValue(true), new JObject() }; foreach (JToken item in items) { Assert.IsNull(JTokenExtensions.ValidItemOrNull(item)); } }
public void ValidItemOrNull_ReturnsItem_IfItIsValid() { var item = new JObject() { { "id", "abc" } }; Assert.AreSame(item, JTokenExtensions.ValidItemOrNull(item)); }