/// <summary> /// Gets the value of a property from a subject node, taking ito account possibly aliases defined in the active context. /// </summary> /// <param name="activeContext">The context to use.</param> /// <param name="parent">The subject node to retrieve a property from</param> /// <param name="propertyName">The name of the property whose value is to be retrieved.</param> /// <returns>The property value if found, null otherwise.</returns> public static JToken GetPropertyValue(JsonLdContext activeContext, JObject parent, string propertyName) { if (parent.TryGetValue(propertyName, out var ret)) { return(ret); } foreach (var alias in activeContext.GetAliases(propertyName)) { if (parent.TryGetValue(alias, out ret)) { return(ret); } } return(null); }
public void ToString_MatchesExpected_ReturnsName(JsonLdContext context, string expectedValue) => Assert.Equal(expectedValue, context.ToString());
public void NotEqualsOperator_IsNotEqual_ReturnsTrue(JsonLdContext a, JsonLdContext b) => Assert.True(a != b);
public void NotEqualsOperator_IsEqual_ReturnsFalse(JsonLdContext a, JsonLdContext b) => Assert.False(a != b);
public void Equals_IsNotEqual_ReturnsFalse(JsonLdContext a, JsonLdContext b) => Assert.False(a.Equals(b));
public void Equals_IsEqual_ReturnsTrue(JsonLdContext a, JsonLdContext b) => Assert.True(a.Equals(b));