/// <summary> /// Verify Common.Core.4123 /// </summary> /// <param name="context">Service context</param> /// <param name="info">out parameter to return violation information when rule fail</param> /// <returns>true if rule passes; false otherwise</returns> public override bool?Verify(ServiceContext context, out ExtensionRuleViolationInfo info) { if (context == null) { throw new ArgumentNullException("context"); } bool?passed = null; info = null; JObject jObj; context.ResponsePayload.TryToJObject(out jObj); List <JToken> jos = new List <JToken>(); JsonParserHelper.GetJsonObjectsFromRespPayload(jObj, ref jos); foreach (JObject jo in jos) { var jProps = jo.Children(); foreach (JProperty jProp in jProps) { if (JsonSchemaHelper.IsAnnotation(jProp.Name) && (context.Version == ODataVersion.V4 ? jProp.Name.StartsWith("@") : !jProp.Name.Contains("@"))) { passed = null; if (jo[jProp.Name] != null) { passed = true; } else { passed = false; info = new ExtensionRuleViolationInfo(this.ErrorMessage, context.Destination, context.ResponsePayload); break; } } } } return(passed); }